public static ExecuteCommand ( string command, string workingDirectory = null ) : void | ||
command | string | |
workingDirectory | string | |
리턴 | void |
/// <summary> /// 删除硬链接目录 /// </summary> /// <param name="linkPath"></param> public static void DeleteLink(string linkPath) { var os = Environment.OSVersion; if (os.ToString().Contains("Windows")) { KEditorUtils.ExecuteCommand(String.Format("rmdir \"{0}\"", linkPath)); } else if (os.ToString().Contains("Unix")) { KEditorUtils.ExecuteCommand(String.Format("rm -Rf \"{0}\"", linkPath)); } else { Debug.LogError(String.Format("[SymbolLinkFolder]Error on OS: {0}", os.ToString())); } }
public static void SymbolLinkFolder(string srcFolderPath, string targetPath) { var os = Environment.OSVersion; if (os.ToString().Contains("Windows")) { KEditorUtils.ExecuteCommand(String.Format("mklink /J \"{0}\" \"{1}\"", targetPath, srcFolderPath)); } else if (os.ToString().Contains("Unix")) { var fullPath = Path.GetFullPath(targetPath); if (fullPath.EndsWith("/")) { fullPath = fullPath.Substring(0, fullPath.Length - 1); fullPath = Path.GetDirectoryName(fullPath); } KEditorUtils.ExecuteCommand(String.Format("ln -s {0} {1}", Path.GetFullPath(srcFolderPath), fullPath)); } else { Debug.LogError(String.Format("[SymbolLinkFolder]Error on OS: {0}", os.ToString())); } }