INNER CODE UNIT · Python
find_inkscape
utopia-rise/godot-jvm · logo/export.py:58
def find_inkscape():
"""Path to the Inkscape executable, or None. Real install locations come first because
package-manager shims on PATH (Chocolatey's, for one) return before the export is written."""
candidates = []
if SYSTEM == 'Windows':
for program_files in (os.environ.get('ProgramFiles'), os.environ.get('ProgramFiles(x86)')):
if program_files:
candidates.append(Path(program_files) / 'Inkscape' / 'bin' / 'inkscape.com')
elif SYSTEM == 'Darwin':
candidates.append(Path('/Applications/Inkscape.app/Contents/MacOS/inkscape'))
for name in ('inkscape.com', 'inkscape'):
found = shutil.which(name)
if found:
candidates.append(Path(found))
for candidate in candidates:
if candidate.is_file():
return candidate
return None