Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions UnityProjectCloner/Editor/ProjectCloner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,13 @@ public static void CopyLibraryFolder(Project sourceProject, Project destinationP
/// <param name="destinationPath"></param>
private static void CreateLinkMac(string sourcePath, string destinationPath)
{
Debug.LogWarning("This hasn't been tested yet! I am mac-less :( Please chime in on the github if it works for you.");
// Debug.LogWarning("This hasn't been tested yet! I am mac-less :( Please chime in on the github if it works for you.");

string cmd = "ln " + string.Format("\"{0}\" \"{1}\"", destinationPath, sourcePath);
string cmd = "-s " + string.Format("\"{0}\" \"{1}\"", sourcePath, destinationPath);
Debug.Log("Mac hard link " + cmd);

ProjectCloner.StartHiddenConsoleProcess("/bin/bash", cmd);
// ProjectCloner.StartHiddenConsoleProcess("/bin/zsh", cmd);
StartProcessWithShell("ln", cmd);
}

/// <summary>
Expand Down Expand Up @@ -482,6 +483,24 @@ private static void StartHiddenConsoleProcess(string fileName, string args)

process.Start();
}

/// <summary>
/// starts process with the system shell
/// </summary>
/// <param name="cmdAndArgs"></param>
/// <returns></returns>
private static void StartProcessWithShell(string cmdName, string Args)
{
var process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = cmdName;
// process.StartInfo.RedirectStandardError = true;
process.StartInfo.Arguments = Args;

process.Start();
process.WaitForExit(-1);
Debug.Log($"cmd process exiting with code :{process.ExitCode}");
}
#endregion
}
}