1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-19 12:28:12 +01:00

Moved which function to another module

This commit is contained in:
2017-01-02 19:27:49 +01:00
parent 38a2322e98
commit 3906e4c80b
4 changed files with 43 additions and 31 deletions

22
fs_uae_wrapper/path.py Normal file
View File

@@ -0,0 +1,22 @@
"""
Misc utilities
"""
import os
def which(executables):
"""
Check if there selected archiver is available in the system and place it
to the archiver attribute
"""
if not isinstance(executables, list):
executables = [executables]
for fname in executables:
for path in os.environ["PATH"].split(os.pathsep):
path = os.path.join(path.strip('"'), fname)
if os.path.isfile(path) and os.access(path, os.X_OK):
return fname
return None