fix none-type passed to os.path
This commit is contained in:
@@ -32,14 +32,17 @@ class Backup():
|
|||||||
|
|
||||||
def preparePath(self):
|
def preparePath(self):
|
||||||
for dir in self.BACKUPDIRECTORY:
|
for dir in self.BACKUPDIRECTORY:
|
||||||
os.mkdir(self.destinationPath + dir)
|
utils.mkdir(self.destinationPath + dir)
|
||||||
|
|
||||||
|
|
||||||
def validatePath(self, path):
|
def validatePath(self, path):
|
||||||
"""Check basic condition for backup directory"""
|
"""Check basic condition for backup directory"""
|
||||||
|
try:
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
print("Error, you provided a file instead of a directory!")
|
print("Error, you provided a file instead of a directory!")
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
print("Provided path is not recognized...")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -69,7 +72,7 @@ class Backup():
|
|||||||
def setPath(self):
|
def setPath(self):
|
||||||
"""Setup backup directory"""
|
"""Setup backup directory"""
|
||||||
user_value = None
|
user_value = None
|
||||||
while (user_value != '' and not self.validatePath(user_value)):
|
while (user_value != '' and user_value != None and not self.validatePath(user_value)):
|
||||||
print("Enter backup path, please provide an empty folder.")
|
print("Enter backup path, please provide an empty folder.")
|
||||||
print("CTRL+C to cancel")
|
print("CTRL+C to cancel")
|
||||||
user_value = utils.user_input("-> ")
|
user_value = utils.user_input("-> ")
|
||||||
|
|||||||
Reference in New Issue
Block a user