No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FileSystemOperation.cs 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. using Codice.Client.Common.Threading;
  5. using PlasticGui;
  6. using PlasticGui.WorkspaceWindow.Items;
  7. namespace Unity.PlasticSCM.Editor.Views
  8. {
  9. internal static class FileSystemOperation
  10. {
  11. internal static string GetExePath()
  12. {
  13. string title = PlasticLocalization.GetString(
  14. PlasticLocalization.Name.BrowseForExecutableFile);
  15. string directory = Environment.GetFolderPath(
  16. Environment.SpecialFolder.ProgramFiles);
  17. string path = EditorUtility.OpenFilePanel(title, directory, null);
  18. if (path.Length != 0)
  19. return path;
  20. return null;
  21. }
  22. internal static void Open(List<string> files)
  23. {
  24. try
  25. {
  26. foreach (string file in files)
  27. OpenFile(file);
  28. }
  29. catch (Exception ex)
  30. {
  31. ExceptionsHandler.DisplayException(ex);
  32. }
  33. }
  34. internal static void OpenInExplorer(string path)
  35. {
  36. EditorUtility.RevealInFinder(path);
  37. }
  38. static void OpenFile(string path)
  39. {
  40. if (path == null)
  41. return;
  42. string relativePath = GetRelativePath.ToApplication(path);
  43. bool result = AssetDatabase.OpenAsset(
  44. AssetDatabase.LoadMainAssetAtPath(relativePath));
  45. if (result)
  46. return;
  47. OpenOperation.OpenFile(path);
  48. }
  49. }
  50. }