This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
forked from felipelerena/FlightDeck
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
# from http://jimmyg.org/blog/2009/working-with-python-subprocess.html | ||
import os | ||
|
||
|
||
# from http://jimmyg.org/blog/2009/working-with-python-subprocess.html | ||
def whereis(program): | ||
for path in os.environ.get('PATH', '').split(':'): | ||
if os.path.exists(os.path.join(path, program)) and \ | ||
not os.path.isdir(os.path.join(path, program)): | ||
return os.path.join(path, program) | ||
return None | ||
|
||
|
||
def make_path(directory): | ||
""" Create all needed directories on the path """ | ||
sections = directory.split('/') | ||
path = '/' | ||
dir_created = False | ||
for d in sections: | ||
path = os.path.join(path, d) | ||
if path and not os.path.isdir(path): | ||
dir_created = True | ||
os.mkdir(path) | ||
|
||
return dir_created | ||
|