Added error checking for the root_path.

This commit is contained in:
Andrew Hamilton 2016-01-29 20:55:43 +00:00
parent 4040b5c807
commit 2230d78575

6
vigil
View file

@ -1076,6 +1076,12 @@ if __name__ == "__main__":
print(_get_help_text()) print(_get_help_text())
sys.exit(0) sys.exit(0)
root_path = os.path.abspath(arguments["<root_path>"]) root_path = os.path.abspath(arguments["<root_path>"])
if not os.path.exists(root_path):
print("File does not exist:", root_path)
sys.exit(1)
if not os.path.isdir(root_path):
print("File is not a directory:", root_path)
sys.exit(1)
is_sandboxed = not arguments["--no-sandbox"] is_sandboxed = not arguments["--no-sandbox"]
if is_sandboxed: if is_sandboxed:
subprocess.call(["sudo", "-p", "Vigil needs sudo to create the filesy" subprocess.call(["sudo", "-p", "Vigil needs sudo to create the filesy"