1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 00:38:52 -05:00

FAIL *facepalm*

This commit is contained in:
Reinhard Pointner 2016-12-06 01:26:05 +09:00
parent 9ab1f33ed1
commit bd8b67422e

View File

@ -318,24 +318,26 @@ public final class FileUtilities {
} }
public static String getName(File file) { public static String getName(File file) {
if (file == null) if (file == null) {
return null; return null;
}
if (file.isDirectory()) if (file.isDirectory() || file.getName().isEmpty() || UNC_PREFIX.equals(file.getParent())) {
return file.getName();
if (file.getName().isEmpty() || UNC_PREFIX.equals(file.getParent()))
return getFolderName(file); return getFolderName(file);
}
return getNameWithoutExtension(file.getName()); return getNameWithoutExtension(file.getName());
} }
public static String getFolderName(File file) { public static String getFolderName(File file) {
if (UNC_PREFIX.equals(file.getParent())) if (UNC_PREFIX.equals(file.getParent())) {
return file.toString(); return file.toString();
}
if (file.getName().length() > 0) String name = file.getName();
return file.getName(); if (name.length() > 0) {
return name;
}
// file might be a drive (only has a path, but no name) // file might be a drive (only has a path, but no name)
return replacePathSeparators(file.toString(), ""); return replacePathSeparators(file.toString(), "");