public static void LocateCache() { if (!System.IO.Directory.Exists(CacheClient.cacheDirectory)) { IOUtilities.CreateDirectory(CacheClient.cacheDirectory); } EditorUtility.RevealInFinder(CacheClient.cacheDirectory); }
private void DisplayProcessedDirectory(string directoryValue) { string processedDir = PluginSettings.ReplaceDirectoryVariables(directoryValue, gameIdProperty.intValue, apiURLProperty.stringValue.StartsWith("https://api.test.mod.io")); EditorGUILayout.BeginHorizontal(); using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.LabelField(new GUIContent(processedDir, processedDir)); } bool directoryIsValid = false; try { string testDir = processedDir; while (!directoryIsValid && !string.IsNullOrEmpty(testDir)) { testDir = System.IO.Path.GetDirectoryName(testDir); directoryIsValid = System.IO.Directory.Exists(testDir); } } catch { directoryIsValid = false; } using (new EditorGUI.DisabledScope(!directoryIsValid)) { string toolTip = null; if (directoryIsValid) { toolTip = "Locate directory"; } else { toolTip = "Invalid directory"; } if (GUILayout.Button(new GUIContent("...", toolTip), GUILayout.Width(21), GUILayout.Height(14))) { if (!System.IO.Directory.Exists(processedDir)) { IOUtilities.CreateDirectory(processedDir); } EditorUtility.RevealInFinder(processedDir); } } EditorGUILayout.EndHorizontal(); }