@@ -105,9 +105,6 @@ def get_settings(self):
105105
106106 contents = codecs .open (config_file , encoding = 'utf-8' ).read ()
107107
108- contents = contents .replace ('{DEFAULT_DOWNLOAD_PATH}' ,
109- config .DEFAULT_DOWNLOAD_PATH )
110-
111108 config_io = StringIO (contents )
112109 config_obj = ConfigObj (config_io , unrepr = True ).dict ()
113110
@@ -362,7 +359,8 @@ def download_file_with_error_handling(self):
362359 in the GUI.
363360 """
364361 setting = self .files_to_download .pop ()
365- location = self .get_setting ('download_dir' ).value
362+ location = (self .get_setting ('download_dir' ).value or
363+ config .download_path ())
366364 version = self .selected_version ()
367365 path = setting .url .format (version , version )
368366
@@ -583,7 +581,8 @@ def selected_version(self):
583581 def extract_files (self ):
584582 """Extract nw.js files to the specific version path"""
585583 self .extract_error = None
586- location = self .get_setting ('download_dir' ).value
584+ location = (self .get_setting ('download_dir' ).value or
585+ config .download_path ())
587586
588587 sdk_build_setting = self .get_setting ('sdk_build' )
589588 sdk_build = sdk_build_setting .value
@@ -1387,7 +1386,8 @@ def download_file(self, path, setting):
13871386 """Download a file from the path and setting"""
13881387 self .logger .info ('Downloading file {}.' .format (path ))
13891388
1390- location = self .get_setting ('download_dir' ).value
1389+ location = (self .get_setting ('download_dir' ).value or
1390+ config .download_path ())
13911391
13921392 sdk_build_setting = self .get_setting ('sdk_build' )
13931393 sdk_build = sdk_build_setting .value
@@ -1496,7 +1496,7 @@ def error(self, message):
14961496 sys .stderr .write ('error: {}\n ' .format (message ))
14971497 sys .exit (2 )
14981498
1499- def get_arguments (command_base ):
1499+ def get_arguments (command_base , args = None ):
15001500 """Retrieves arguments from the command line"""
15011501
15021502 parser = ArgParser (description = ('Command line interface '
@@ -1535,6 +1535,9 @@ def get_arguments(command_base):
15351535 help = ('Choose at least one system '
15361536 'to export to.' ))
15371537
1538+ if args :
1539+ return parse .parse_args (args )
1540+
15381541 return parser .parse_args ()
15391542
15401543def generate_setting_args (command_base , parser ):
@@ -1678,12 +1681,12 @@ def initialize_setting_values(args, command_base):
16781681 if setting is not None :
16791682 setting .value = val
16801683
1681- def main ():
1684+ def main (args = None ):
16821685 """Main setup and argument parsing"""
16831686 command_base = CommandBase ()
16841687 command_base .init ()
16851688
1686- args = get_arguments (command_base )
1689+ args = get_arguments (command_base , args )
16871690
16881691 setup_logging (args , command_base )
16891692 setup_directories (args , command_base )
0 commit comments