| | |
| | | Debug.Log("External Path: " + ExternalStorePath); |
| | | } |
| | | |
| | | public void CleanCache() |
| | | { |
| | | // ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | // Language.Get("CleanCache2"), (bool isOk) => |
| | | // { |
| | | // if (isOk) |
| | | // { |
| | | // try |
| | | // { |
| | | // // 获取persistentDataPath下的所有文件和文件夹 |
| | | // string[] files = Directory.GetFiles(ExternalStorePath); |
| | | // string[] dirs = Directory.GetDirectories(ExternalStorePath); |
| | | |
| | | // // 删除所有文件 |
| | | // foreach (string file in files) |
| | | // { |
| | | // if (file.Contains("config")) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // File.Delete(file); |
| | | // } |
| | | |
| | | |
| | | // // 递归删除所有文件夹 |
| | | // foreach (string dir in dirs) |
| | | // { |
| | | // if (dir.Contains("config")) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // Directory.Delete(dir, true); |
| | | // } |
| | | |
| | | // files = Directory.GetFiles(ExternalStorePath + "/config"); |
| | | // foreach (string file in files) |
| | | // { |
| | | // bool isDelete = true; |
| | | // foreach (string filename in ConfigInitiator.builtinConfig) |
| | | // { |
| | | // if (file.Contains(filename)) |
| | | // { |
| | | // isDelete = false; |
| | | // break; |
| | | // } |
| | | // } |
| | | |
| | | // if (isDelete) |
| | | // File.Delete(file); |
| | | // } |
| | | |
| | | |
| | | // } |
| | | // catch (System.Exception e) |
| | | // { |
| | | // Debug.LogError("Failed to clean persistent data: " + e.Message); |
| | | // } |
| | | // finally |
| | | // { |
| | | // Clock.AlarmAfter(0.1f, () => |
| | | // { |
| | | // Application.Quit(); |
| | | // }); |
| | | // Debug.Log("Persistent data cleaned."); |
| | | // } |
| | | |
| | | // } |
| | | // }); |
| | | |
| | | |
| | | } |
| | | } |