Fix #584
This commit is contained in:
parent
39407286b3
commit
1ca585a65c
@ -226,7 +226,7 @@ def get_recursive_filelist(pathlist: list[str]) -> list[str]:
|
||||
|
||||
|
||||
def add_to_path(dirname: str) -> None:
|
||||
if dirname:
|
||||
if dirname and os.path.isdir(dirname):
|
||||
dirname = os.path.abspath(dirname)
|
||||
paths = [os.path.normpath(x) for x in split(os.environ["PATH"], os.pathsep)]
|
||||
|
||||
|
@ -19,6 +19,8 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
import settngs
|
||||
|
||||
@ -308,12 +310,18 @@ def validate_commandline_settings(config: settngs.Config[ct_ns], parser: settngs
|
||||
if not utils.which("rar"):
|
||||
if platform.system() == "Windows":
|
||||
# look in some likely places for Windows machines
|
||||
if os.path.exists(r"C:\Program Files\WinRAR\Rar.exe"):
|
||||
utils.add_to_path(r"C:\Program Files\WinRAR")
|
||||
elif os.path.exists(r"C:\Program Files (x86)\WinRAR\Rar.exe"):
|
||||
utils.add_to_path(r"C:\Program Files (x86)\WinRAR")
|
||||
utils.add_to_path(r"C:\Program Files\WinRAR")
|
||||
utils.add_to_path(r"C:\Program Files (x86)\WinRAR")
|
||||
else:
|
||||
if os.path.exists("/opt/homebrew/bin"):
|
||||
utils.add_to_path("/opt/homebrew/bin")
|
||||
if platform.system() == "Darwin":
|
||||
result = subprocess.run(("/usr/libexec/path_helper", "-s"), capture_output=True)
|
||||
for path in reversed(
|
||||
shlex.split(result.stdout.decode("utf-8", errors="ignore"))[0]
|
||||
.partition("=")[2]
|
||||
.rstrip(";")
|
||||
.split(os.pathsep)
|
||||
):
|
||||
utils.add_to_path(path)
|
||||
utils.add_to_path("/opt/homebrew/bin")
|
||||
|
||||
return config
|
||||
|
@ -60,7 +60,7 @@ macRarHelp = """
|
||||
you will need the rar tool. The easiest way to get this is
|
||||
to install <span style=" text-decoration: underline; color:#0000ff;">
|
||||
<a href="https://brew.sh/">homebrew</a></span>.
|
||||
</p>Once homebrew is installed, run: <b>brew install caskroom/cask/rar</b></body></html>
|
||||
</p>Once homebrew is installed, run: <b>brew install rar</b></body></html>
|
||||
"""
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user