优化 脚本管理器增删文件后的更新
新增 支持插件 优化 多点找色的内存泄漏 修复 文件重命名时的后缀问题 修复 脚本抛出Throwable不能被捕捉的问题
This commit is contained in:
@@ -50,15 +50,19 @@ public class PFile extends File {
|
||||
mSimplifyPath = PFiles.getSimplifiedPath(getPath());
|
||||
}
|
||||
|
||||
public boolean renameTo(String newName) {
|
||||
if (isDirectory())
|
||||
return renameTo(new File(getParent(), newName));
|
||||
else
|
||||
return renameTo(new File(getParent(), newName + "." + getExtension()));
|
||||
|
||||
@NonNull
|
||||
public PFile renameTo(String newName) {
|
||||
PFile newFile = new PFile(getParent(), newName);
|
||||
if (renameTo(newFile)) {
|
||||
return newFile;
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PFile renameAndReturnNewFile(String newName) {
|
||||
@NonNull
|
||||
public PFile renameWithoutExt(String newName) {
|
||||
PFile newFile = isDirectory() ? new PFile(getParent(), newName) :
|
||||
new PFile(getParent(), newName + "." + getExtension());
|
||||
if (renameTo(newFile)) {
|
||||
|
||||
@@ -296,9 +296,8 @@ public class PFiles {
|
||||
}
|
||||
|
||||
|
||||
public static void copyAssetDir(Context context, String assetsDir, String toDir, String[] list) throws IOException {
|
||||
public static void copyAssetDir(AssetManager manager, String assetsDir, String toDir, String[] list) throws IOException {
|
||||
new File(toDir).mkdirs();
|
||||
AssetManager manager = context.getAssets();
|
||||
if (list == null) {
|
||||
list = manager.list(assetsDir);
|
||||
}
|
||||
@@ -323,7 +322,7 @@ public class PFiles {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
copyAssetDir(context, fullAssetsPath, join(toDir, file), children);
|
||||
copyAssetDir(manager, fullAssetsPath, join(toDir, file), children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user