Commit 402e9d9a authored by fallenstardust's avatar fallenstardust

可选是否替换

parent d0381018
......@@ -249,10 +249,9 @@ public class MainActivity extends HomeActivity {
AppsSettings.get().getSoundPath(), false);
//复制原目录文件
FileUtils.copyDir(ORI_DECK, AppsSettings.get().getDeckDir());
FileUtils.copyDir(ORI_REPLAY, AppsSettings.get().getResourcePath() + "/" + Constants.CORE_REPLAY_PATH);
FileUtils.copyDir(ORI_TEXTURES, AppsSettings.get().getCoreSkinPath());
FileUtils.copyDir(ORI_PICS, AppsSettings.get().getCardImagePath());
FileUtils.copyDir(ORI_DECK, AppsSettings.get().getDeckDir(), false);
FileUtils.copyDir(ORI_REPLAY, AppsSettings.get().getResourcePath() + "/" + Constants.CORE_REPLAY_PATH, false);
FileUtils.copyDir(ORI_PICS, AppsSettings.get().getCardImagePath(), false);
} catch (IOException e) {
e.printStackTrace();
Log.e("MainActivity", "错误" + e);
......
......@@ -271,10 +271,10 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.WINDBOT_PATH),
resPath, needsUpdate);
//复制原目录文件
FileUtils.copyDir(ORI_DECK, mSettings.getDeckDir());
FileUtils.copyDir(ORI_REPLAY, resPath + "/" + Constants.CORE_REPLAY_PATH);
FileUtils.copyDir(ORI_TEXTURES, mSettings.getCoreSkinPath());
FileUtils.copyDir(ORI_PICS, mSettings.getCardImagePath());
FileUtils.copyDir(ORI_DECK, mSettings.getDeckDir(), false);
FileUtils.copyDir(ORI_REPLAY, resPath + "/" + Constants.CORE_REPLAY_PATH, false);
FileUtils.copyDir(ORI_TEXTURES, mSettings.getCoreSkinPath(), true);
FileUtils.copyDir(ORI_PICS, mSettings.getCardImagePath(), false);
han.sendEmptyMessage(0);
......
......@@ -170,8 +170,9 @@ public class FileUtils {
out.write(data, 0, len);
}
}
//复制文件夹全部文件
public static void copyDir(String oldPath, String newPath) throws IOException {
public static void copyDir(String oldPath, String newPath, boolean isReplaced) throws IOException {
File file = new File(oldPath);
//文件名称列表
String[] filePath = file.list();
......@@ -182,11 +183,11 @@ public class FileUtils {
for (int i = 0; i < filePath.length; i++) {
if ((new File(oldPath + file.separator + filePath[i])).isDirectory()) {
copyDir(oldPath + file.separator + filePath[i], newPath + file.separator + filePath[i]);
copyDir(oldPath + file.separator + filePath[i], newPath + file.separator + filePath[i], false);
}
if (new File(oldPath + file.separator + filePath[i]).isFile()) {
if (!(new File(newPath + file.separator + filePath[i]).exists()))
if (new File(oldPath + file.separator + filePath[i]).isFile()) {
if (!(new File(newPath + file.separator + filePath[i]).exists()) || isReplaced)
copyFile(oldPath + file.separator + filePath[i], newPath + file.separator + filePath[i], true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment