fix: dealing with ffmpeg environmental dependency loss

This commit is contained in:
ihmily
2025-03-25 13:39:15 +08:00
parent a2612e6fcb
commit c436d64a96

View File

@@ -16,7 +16,6 @@ from ..utils.utils import get_startup_info
current_platform = platform.system()
execute_dir = os.path.split(os.path.realpath(sys.argv[0]))[0]
current_env_path = os.environ.get("PATH")
node_path = os.path.join(execute_dir, "node")
startupinfo = get_startup_info()
@@ -97,7 +96,7 @@ async def install_nodejs_windows(update_progress):
if Path(new_extract_dir_path).exists():
shutil.rmtree(new_extract_dir_path)
os.rename(extract_dir_path, new_extract_dir_path)
os.environ["PATH"] = execute_dir + "/node" + os.pathsep + current_env_path
os.environ["PATH"] = execute_dir + "/node" + os.pathsep + os.environ.get("PATH")
result = subprocess.run(["node", "-v"], capture_output=True, startupinfo=startupinfo)
if result.returncode == 0:
return True
@@ -216,6 +215,7 @@ async def install_nodejs(update_progress) -> bool:
def update_env_path():
current_env_path = os.environ.get("PATH")
if current_platform != "Windows":
path_list = ["/usr/bin/", "/usr/local/bin", "/opt/homebrew/bin"]
current_env_path_list = current_env_path.split(os.pathsep)