mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-01-29 10:38:14 +01:00
remove unused fuzzyexists
This commit is contained in:
parent
ffa11e8aa7
commit
6bbd75a824
@ -81,7 +81,7 @@ class DownloadFileThread extends Thread {
|
||||
return;
|
||||
}
|
||||
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()) {
|
||||
if (Utils.getConfigBoolean("file.overwrite", false)) {
|
||||
logger.info("[!] " + Utils.getLocalizedString("deleting.existing.file") + prettySaveAs);
|
||||
|
@ -862,28 +862,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
// Checks if a file exists ignoring it's extension.
|
||||
// Code from: https://stackoverflow.com/a/17698068
|
||||
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) {
|
||||
public static boolean fuzzyExists(Path folder, String filename) {
|
||||
return Files.exists(folder.resolve(filename));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user