/// <summary> /// Creates a symlink between destinationPath and sourcePath (Windows version). /// </summary> /// <param name="sourcePath"></param> /// <param name="destinationPath"></param> private static void CreateLinkWin(string sourcePath, string destinationPath) { string cmd = "/C mklink /J " + string.Format("\"{0}\" \"{1}\"", destinationPath, sourcePath); Debug.Log("Windows junction: " + cmd); ClonesManager.StartHiddenConsoleProcess("cmd.exe", cmd); }
/// <summary> /// Creates a symlink between destinationPath and sourcePath (Mac version). /// </summary> /// <param name="sourcePath"></param> /// <param name="destinationPath"></param> private static void CreateLinkMac(string sourcePath, string destinationPath) { Debug.LogWarning("This hasn't been tested yet!"); string cmd = "ln " + string.Format("\"{0}\" \"{1}\"", destinationPath, sourcePath); Debug.Log("Mac hard link " + cmd); ClonesManager.StartHiddenConsoleProcess("/bin/bash", cmd); }
/// <summary> /// Opens a project located at the given path (if one exists). /// </summary> /// <param name="projectPath"></param> public static void OpenProject(string projectPath) { if (!Directory.Exists(projectPath)) { Debug.LogError("Cannot open the project - provided folder (" + projectPath + ") does not exist."); return; } if (projectPath == ClonesManager.GetCurrentProjectPath()) { Debug.LogError("Cannot open the project - it is already open."); return; } string fileName = EditorApplication.applicationPath; string args = "-projectPath \"" + projectPath + "\""; Debug.Log("Opening project \"" + fileName + " " + args + "\""); ClonesManager.StartHiddenConsoleProcess(fileName, args); }
/// <summary> /// Opens a project located at the given path (if one exists). /// </summary> /// <param name="projectPath"></param> public static void OpenProject(string projectPath) { if (!Directory.Exists(projectPath)) { Debug.LogError("Cannot open the project - provided folder (" + projectPath + ") does not exist."); return; } if (projectPath == ClonesManager.GetCurrentProjectPath()) { Debug.LogError("Cannot open the project - it is already open."); return; } //Validate (and update if needed) the "Packages" folder before opening clone project to ensure the clone project will have the //same "compiling environment" as the original project ValidateCopiedFoldersIntegrity.ValidateFolder(projectPath, GetOriginalProjectPath(), "Packages"); string fileName = GetApplicationPath(); string args = "-projectPath \"" + projectPath + "\""; Debug.Log("Opening project \"" + fileName + " " + args + "\""); ClonesManager.StartHiddenConsoleProcess(fileName, args); }