Add workflow base into default PYTHONPATH for win32
This commit is contained in:
parent
bbc6c1e4e6
commit
4549fadd98
@ -37,10 +37,17 @@ export async function installDevchat(): Promise<string> {
|
||||
const pythonPathFile = path.join(pythonTargetPath, "python311._pth");
|
||||
const sitepackagesPath = path.join(UiUtilWrapper.extensionPath(), "tools", "site-packages");
|
||||
|
||||
const userHomeDir = os.homedir();
|
||||
// TODO: temperary workflow base dir name, need to change
|
||||
const WORKFLOWS_BASE_NAME = "new_wf";
|
||||
const workflow_base_path = path.join(userHomeDir, ".chat", WORKFLOWS_BASE_NAME);
|
||||
|
||||
const new_python_path = [workflow_base_path, sitepackagesPath].join("\n");
|
||||
|
||||
// read content in pythonPathFile
|
||||
let content = fs.readFileSync(pythonPathFile, { encoding: 'utf-8' });
|
||||
// replace %PYTHONPATH% with sitepackagesPath
|
||||
content = content.replace(/%PYTHONPATH%/g, sitepackagesPath);
|
||||
content = content.replace(/%PYTHONPATH%/g, new_python_path);
|
||||
// write content to pythonPathFile
|
||||
fs.writeFileSync(pythonPathFile, content);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user