0

Attempt to detect if the user has forgotten to escape spaces in their paths

This commit is contained in:
Andrew Chin
2011-08-23 20:35:19 -04:00
parent 03f9734039
commit 240fe128cb

View File

@@ -154,6 +154,17 @@ def main():
sys.exit(1) sys.exit(1)
worlddir = args[0] worlddir = args[0]
if len(args) > 2:
# it's possible the user has a space in one of their paths but didn't properly escape it
# attempt to detect this case
for start in range(len(args)):
if not os.path.exists(args[start]):
for end in range(start+1, len(args)+1):
if os.path.exists(" ".join(args[start:end])):
logging.warning("It looks like you meant to specify \"%s\" as your world dir or your output\n\
dir but you forgot to put quotes around the directory, since it contains spaces." % " ".join(args[start:end]))
sys.exit(1)
if not os.path.exists(worlddir): if not os.path.exists(worlddir):
# world given is either world number, or name # world given is either world number, or name
worlds = world.get_worlds() worlds = world.get_worlds()