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:
22
fs_uae_wrapper/path.py
Normal file
22
fs_uae_wrapper/path.py
Normal 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
|
||||
Reference in New Issue
Block a user