Skip to content

Commit

Permalink
Added is_path_valid()
Browse files Browse the repository at this point in the history
  • Loading branch information
korcankaraokcu committed Mar 29, 2016
1 parent 87cff97 commit dc5b68f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
55 changes: 29 additions & 26 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions SysUtils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3
import psutil
from re import match, search, IGNORECASE
from os import path
from os import path, makedirs
from sys import path as syspath


Expand Down Expand Up @@ -84,7 +84,7 @@ def is_traced(pid=int):

# return True if the process is still running, False if not
def is_process_valid(pid=int):
return path.exists("/proc/%d" % pid)
return is_path_valid("/proc/%d" % pid)


# returns a string pointing to the home directory
Expand All @@ -95,3 +95,10 @@ def get_home_directory():
# returns a string pointing to the py file currently working
def get_current_script_directory():
return syspath[0]

def is_path_valid(dest_path, create_path=False):
if not path.exists(dest_path):
if create_path:
makedirs(dest_path)
return False
return True

0 comments on commit dc5b68f

Please sign in to comment.