浏览代码

Polish message when starting app

/pyrception-integration
leopoldo-zugasti 4 年前
当前提交
945664d3
共有 1 个文件被更改,包括 10 次插入22 次删除
  1. 32
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

32
com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs


[MenuItem("Window/Pyrception/Run")]
static void RunPyrception()
{
#if UNITY_EDITOR_WIN || true
#elif UNITY_EDITOR_OSX
//KillProcess();
#endif
string path = Path.GetFullPath(Application.dataPath.Replace("/Assets", ""));
#if UNITY_EDITOR_WIN
string packagesPath = Path.GetFullPath(Application.dataPath.Replace("/Assets","/Library/PythonInstall/Scripts"));

ExecuteCMD(command, ref ExitCode, waitForExit: false, displayWindow: true);
if (ExitCode != 0)
{
return;
UnityEngine.Debug.LogError("Problem occured when launching pyrception-utils - Exit Code: " + ExitCode);
if (EditorUtility.DisplayDialog("Data Visualizer Launch",
"A browser window should open shortly, otherwise use the manual launch", "Manually Launch", "Close"))
{
Process.Start("http://localhost:8501");
}
}
}

return false;
}
#if UNITY_EDITOR_OSX
private static void KillProcess()
{
if (currentProcessId != -1)
{
Process proc = Process.GetProcessById(currentProcessId + 1);
proc.Kill();
currentProcessId = -1;
}
}
#endif
/// <summary>
/// Executes command in cmd or console depending on system
/// </summary>

#endif
ProcessStartInfo info = new ProcessStartInfo(shell, argument);
info.CreateNoWindow = !displayWindow;
info.UseShellExecute = !waitForExit;
info.RedirectStandardOutput = redirectOutput && waitForExit;
info.CreateNoWindow = !displayWindow || true;
info.UseShellExecute = !waitForExit && false;
info.RedirectStandardOutput = redirectOutput && waitForExit && false;
info.RedirectStandardError = waitForExit;
Process cmd = Process.Start(info);

正在加载...
取消
保存