Move outputpath handling in main(), create path if it doesn't exist

This commit is contained in:
Bonta-kun 2019-12-28 17:12:27 +01:00
parent 41009c85c7
commit 93f8a684f1
2 changed files with 8 additions and 4 deletions

View File

@ -9,7 +9,7 @@ import shlex
import sys import sys
from Main import main from Main import main
from Utils import is_bundled, close_console, output_path from Utils import is_bundled, close_console
class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter): class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter):
@ -294,9 +294,6 @@ def parse_arguments(argv, no_defaults=False):
def start(): def start():
args = parse_arguments(None) args = parse_arguments(None)
if args.outputpath and os.path.isdir(args.outputpath):
output_path.cached_path = args.outputpath
if is_bundled() and len(sys.argv) == 1: if is_bundled() and len(sys.argv) == 1:
# for the bundled builds, if we have no arguments, the user # for the bundled builds, if we have no arguments, the user
# probably wants the gui. Users of the bundled build who want the command line # probably wants the gui. Users of the bundled build who want the command line

View File

@ -22,6 +22,13 @@ from Utils import output_path, parse_names_string
__version__ = '0.6.3-pre' __version__ = '0.6.3-pre'
def main(args, seed=None): def main(args, seed=None):
if args.outputpath:
try:
os.mkdir(args.outputpath)
except OSError:
pass
output_path.cached_path = args.outputpath
start = time.process_time() start = time.process_time()
# initialize the world # initialize the world