mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-09-01 09:53:53 +02:00
remove unused fuzzyexists
This commit is contained in:
@@ -81,7 +81,7 @@ class DownloadFileThread extends Thread {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (saveAs.exists() && !observer.tryResumeDownload() && !getFileExtFromMIME
|
if (saveAs.exists() && !observer.tryResumeDownload() && !getFileExtFromMIME
|
||||||
|| Utils.fuzzyExistsBetter(Paths.get(saveAs.getParent()), saveAs.getName()) && getFileExtFromMIME
|
|| Utils.fuzzyExists(Paths.get(saveAs.getParent()), saveAs.getName()) && getFileExtFromMIME
|
||||||
&& !observer.tryResumeDownload()) {
|
&& !observer.tryResumeDownload()) {
|
||||||
if (Utils.getConfigBoolean("file.overwrite", false)) {
|
if (Utils.getConfigBoolean("file.overwrite", false)) {
|
||||||
logger.info("[!] " + Utils.getLocalizedString("deleting.existing.file") + prettySaveAs);
|
logger.info("[!] " + Utils.getLocalizedString("deleting.existing.file") + prettySaveAs);
|
||||||
|
@@ -862,28 +862,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checks if a file exists ignoring it's extension.
|
// Checks if a file exists ignoring it's extension.
|
||||||
// Code from: https://stackoverflow.com/a/17698068
|
public static boolean fuzzyExists(Path folder, String filename) {
|
||||||
public static boolean fuzzyExists(File folder, String fileName) {
|
|
||||||
if (!folder.exists()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
File[] listOfFiles = folder.listFiles();
|
|
||||||
if (listOfFiles == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : listOfFiles) {
|
|
||||||
if (file.isFile()) {
|
|
||||||
String[] filename = file.getName().split("\\.(?=[^.]+$)"); // split filename from it's extension
|
|
||||||
if (filename[0].equalsIgnoreCase(fileName)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean fuzzyExistsBetter(Path folder, String filename) {
|
|
||||||
return Files.exists(folder.resolve(filename));
|
return Files.exists(folder.resolve(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user