浏览代码

Improve where file for streamlit instances is stored

/pyrception-integration
leopoldo-zugasti 3 年前
当前提交
dbf34a22
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 5
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

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


//This files stores entries as ProjectDataPath,PythonPID,Port,PyrceptionPID
//It keeps a record of the instances of pyrception opened so that we don't open a new one everytime
private static readonly string _filename_streamlit_instances = "streamlit_instances.csv";
private static readonly string _filename_streamlit_instances = "Unity/cache/streamlit_instances.csv";
private static string pathToStreamlitInstances
{
get

#elif UNITY_EDITOR_OSX
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), _filename_streamlit_instances);
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), _filename_streamlit_instances);
#endif
}
}

private static (int pythonPID, int port, int pyrceptionPID) ReadEntry(string project)
{
string path = pathToStreamlitInstances;
if (!Directory.Exists(pathToStreamlitInstances))
if (!File.Exists(path))
return (-1,-1,-1);
using (StreamReader sr = File.OpenText(path))

正在加载...
取消
保存