1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18: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) {
if (file == null)
if (file == null) {
return null;
}
if (file.isDirectory())
return file.getName();
if (file.getName().isEmpty() || UNC_PREFIX.equals(file.getParent()))
if (file.isDirectory() || file.getName().isEmpty() || UNC_PREFIX.equals(file.getParent())) {
return getFolderName(file);
}
return getNameWithoutExtension(file.getName());
}
public static String getFolderName(File file) {
if (UNC_PREFIX.equals(file.getParent()))
if (UNC_PREFIX.equals(file.getParent())) {
return file.toString();
}
if (file.getName().length() > 0)
return file.getName();
String name = file.getName();
if (name.length() > 0) {
return name;
}
// file might be a drive (only has a path, but no name)
return replacePathSeparators(file.toString(), "");