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