fix: files.create() cannot create dir
This commit is contained in:
@@ -56,12 +56,17 @@ public class PFiles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean create(String path) {
|
public static boolean create(String path) {
|
||||||
|
File f = new File(path);
|
||||||
|
if (path.endsWith(File.separator)) {
|
||||||
|
return f.mkdir();
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
return new File(path).createNewFile();
|
return f.createNewFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean createIfNotExists(String path) {
|
public static boolean createIfNotExists(String path) {
|
||||||
ensureDir(path);
|
ensureDir(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user