Skip to content

Commit

Permalink
Added some path checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshi_E authored and Yoshi_E committed Dec 4, 2017
1 parent 7adb609 commit 98bef0e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions WowsReplayTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,24 @@
default_path = ''.join(args['path'])
else:
default_path = ''.join(args['path'])+"/"

if(os.path.exists(default_path)==False or os.path.isdir(default_path) == False):
print("Failed to find path: "+default_path)
sys.exit()

if(os.path.exists(''.join(args['output']))==True and os.path.isdir(''.join(args['output'])) == True):
cvs_output = ''.join(args['output'])+"/"
else:
print("Failed to find path: "+cvs_output)
sys.exit()

cvs_output = ''.join(args['output'])+"/"
#isDir

if(args['prefix'] == ""):
cvs_prefix = ""
else:
cvs_prefix = ''.join(args['prefix']).replace("/","").replace("\\","")
wait_before_closing = args['wait']

shipDB_path = os.path.dirname(sys.executable)
#If In script:
if("Python" in shipDB_path):
Expand Down Expand Up @@ -366,9 +376,6 @@ def statsGenerator():
csvw = csv.DictWriter(csvfile, fieldnames=jsonData.keys())
csvw.writeheader()
csvw.writerow(jsonData)

if(counter['battles_total'] ==0):
print("Warning: No replays found in: "+default_path)
print("Done! Data Stored in .csv files")


Expand All @@ -386,9 +393,11 @@ def searchUser(User):

print("------------------------------------------------------------------------")
if(args['extract'] != ""):
#isfile
extractReplay(''.join(args['extract']))

tempPath = ''.join(args['extract'])
if(os.path.exists(tempPath)==True and os.path.isFile(tempPath) == True):
extractReplay(tempPath)
else:
print("Replay not found at: "+tempPath)
elif(args['searchUser'] != ""):
searchUser(''.join(args['searchUser']))
else:
Expand Down

0 comments on commit 98bef0e

Please sign in to comment.