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