mirror of
https://github.com/revanced/smali.git
synced 2025-05-02 07:34:28 +02:00
Make windows reserved filename detection more robust
This checks for more reserved filenames than just aux
This commit is contained in:
parent
d868692e33
commit
6cd686fbf5
@ -127,9 +127,12 @@ public class ClassFileNameHandler {
|
||||
}
|
||||
|
||||
private static boolean testForWindowsReservedFileNames(File path) {
|
||||
File f = new File(path, "aux.smali");
|
||||
String[] reservedNames = new String[]{"aux", "con", "com1", "com9", "lpt1", "com9"};
|
||||
|
||||
for (String reservedName: reservedNames) {
|
||||
File f = new File(path, reservedName + ".smali");
|
||||
if (f.exists()) {
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -138,12 +141,13 @@ public class ClassFileNameHandler {
|
||||
writer.flush();
|
||||
writer.close();
|
||||
f.delete(); //doesn't throw IOException
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
//if an exception occured, it's likely that we're on a windows system.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Pattern reservedFileNameRegex = Pattern.compile("^CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]$",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user