SDataCleanHelper.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace SFramework.Editor
  6. {
  7. public class SDataCleanHelper
  8. {
  9. [MenuItem("SFramework/Data Clean/Open PC PersistentDataPath Folder")]
  10. public static void OpenPersistentDataPath()
  11. {
  12. System.Diagnostics.Process.Start(Application.persistentDataPath);
  13. }
  14. [MenuItem("SFramework/Data Clean/Clear PC PersistentDataPath")]
  15. public static void ClearPersistentDataPath()
  16. {
  17. foreach (string dir in System.IO.Directory.GetDirectories(Application.persistentDataPath))
  18. {
  19. System.IO.Directory.Delete(dir, true);
  20. }
  21. foreach (string file in System.IO.Directory.GetFiles(Application.persistentDataPath))
  22. {
  23. System.IO.File.Delete(file);
  24. }
  25. //SAssetsBundleHelper.ShowDialog("PersistentDataPath Cleared!");
  26. Debug.Log("PersistentDataPath Cleared!");
  27. }
  28. [MenuItem("SFramework/Data Clean/Clear Prefs")]
  29. public static void ClearPlayerPrefs()
  30. {
  31. PlayerPrefs.DeleteAll();
  32. PlayerPrefs.Save();
  33. SAssetsBundleHelper.ShowDialog("Prefs Cleared!");
  34. }
  35. }
  36. }