@@ -492,24 +492,30 @@ def generate_json(self, global_json=False):
492492 dic .update ({'webkit' : {}, 'window' : {}})
493493 dic .update (self .original_packagejson )
494494 for setting_name , setting in self .settings ['app_settings' ].items ():
495- if setting .value is not None :
495+ if setting .value is not None and setting . value != '' :
496496 dic [setting_name ] = setting .value
497497 if setting_name == 'keywords' :
498498 dic [setting_name ] = re .findall ('\w+' , setting .value )
499+ else :
500+ dic .pop (setting_name , '' )
499501
500502 for setting_name , setting in self .settings ['window_settings' ].items ():
501- if setting .value is not None :
503+ if setting .value is not None and setting . value != '' :
502504 if 'height' in setting .name or 'width' in setting .name :
503505 try :
504506 dic ['window' ][setting_name ] = int (setting .value )
505507 except ValueError :
506508 pass
507509 else :
508510 dic ['window' ][setting_name ] = setting .value
511+ else :
512+ dic ['window' ].pop (setting_name , '' )
509513
510514 for setting_name , setting in self .settings ['webkit_settings' ].items ():
511- if setting .value is not None :
515+ if setting .value is not None and setting . value != '' :
512516 dic ['webkit' ][setting_name ] = setting .value
517+ else :
518+ dic ['webkit' ].pop (setting_name , '' )
513519
514520 if not global_json :
515521 dl_export_items = (list (self .settings ['download_settings' ].items ()) +
@@ -607,14 +613,6 @@ def extract_files(self):
607613 extract_path = get_data_path ('files/' + setting .name )
608614 setting .extract (extract_path , version )
609615
610- #if os.path.exists(save_file_path):
611- # setting_fbytes = setting.get_file_bytes(version)
612- # for dest_file, fbytes in setting_fbytes:
613- # path = utils.path_join(extract_path, dest_file)
614- # with open(path, 'wb+') as d:
615- # d.write(fbytes)
616- # self.progress_text += '.'
617-
618616 self .progress_text += '.'
619617
620618 except (tarfile .ReadError , zipfile .BadZipfile ) as e :
@@ -690,12 +688,18 @@ def make_output_dirs(self):
690688
691689 zip_file = utils .path_join (temp_dir , self .project_name ()+ '.nw' )
692690
693- app_nw_folder = utils .path_join (temp_dir , self .project_name ()+ '.nwf' )
691+ uncomp_setting = self .get_setting ('uncompressed_folder' )
692+ uncompressed = uncomp_setting .value
694693
695- utils .copytree (self .project_dir (), app_nw_folder ,
696- ignore = shutil .ignore_patterns (output_dir ))
694+ if uncompressed :
695+ app_nw_folder = utils .path_join (temp_dir , self .project_name ()+ '.nwf' )
696+
697+ utils .copytree (self .project_dir (), app_nw_folder ,
698+ ignore = shutil .ignore_patterns (output_dir ))
699+
700+ else :
701+ zip_files (zip_file , self .project_dir (), exclude_paths = [output_dir ])
697702
698- zip_files (zip_file , self .project_dir (), exclude_paths = [output_dir ])
699703 for ex_setting in self .settings ['export_settings' ].values ():
700704 if ex_setting .value :
701705 self .progress_text = '\n '
@@ -704,8 +708,8 @@ def make_output_dirs(self):
704708 export_dest = utils .path_join (output_dir , ex_setting .name )
705709 versions = re .findall ('(\d+)\.(\d+)\.(\d+)' , self .selected_version ())[0 ]
706710
707- minor = int (versions [1 ])
708- if minor >= 12 :
711+ minor_ver = int (versions [1 ])
712+ if minor_ver >= 12 :
709713 export_dest = export_dest .replace ('node-webkit' , 'nwjs' )
710714
711715 if os .path .exists (export_dest ):
@@ -719,18 +723,16 @@ def make_output_dirs(self):
719723 self .progress_text += '.'
720724
721725 if 'mac' in ex_setting .name :
722- uncomp_setting = self .get_setting ('uncompressed_folder' )
723- uncompressed = uncomp_setting .value
724726 app_path = utils .path_join (export_dest ,
725- self .project_name ()+ '.app' )
727+ self .project_name ()+ '.app' )
726728
727729 try :
728730 utils .move (utils .path_join (export_dest ,
729- 'nwjs.app' ),
731+ 'nwjs.app' ),
730732 app_path )
731733 except IOError :
732734 utils .move (utils .path_join (export_dest ,
733- 'node-webkit.app' ),
735+ 'node-webkit.app' ),
734736 app_path )
735737
736738 plist_path = utils .path_join (app_path , 'Contents' , 'Info.plist' )
@@ -749,18 +751,18 @@ def make_output_dirs(self):
749751 self .progress_text += '.'
750752
751753 app_nw_res = utils .path_join (app_path ,
752- 'Contents' ,
753- 'Resources' ,
754- 'app.nw' )
754+ 'Contents' ,
755+ 'Resources' ,
756+ 'app.nw' )
755757
756758 if uncompressed :
757759 utils .copytree (app_nw_folder , app_nw_res )
758760 else :
759761 utils .copy (zip_file , app_nw_res )
760762 self .create_icns_for_app (utils .path_join (app_path ,
761- 'Contents' ,
762- 'Resources' ,
763- 'nw.icns' ))
763+ 'Contents' ,
764+ 'Resources' ,
765+ 'nw.icns' ))
764766
765767 self .progress_text += '.'
766768 else :
@@ -771,20 +773,28 @@ def make_output_dirs(self):
771773 windows = True
772774
773775 nw_path = utils .path_join (export_dest ,
774- ex_setting .dest_files [0 ])
776+ ex_setting .dest_files [0 ])
775777
776778 if windows :
777779 self .replace_icon_in_exe (nw_path )
778780
779781 self .compress_nw (nw_path )
780782
781783 dest_binary_path = utils .path_join (export_dest ,
782- self .project_name () +
783- ext )
784+ self .project_name () +
785+ ext )
784786 if 'linux' in ex_setting .name :
785787 self .make_desktop_file (dest_binary_path , export_dest )
786788
787- join_files (dest_binary_path , nw_path , zip_file )
789+ if minor_ver >= 13 :
790+ package_loc = utils .path_join (export_dest , 'package.nw' )
791+ if uncompressed :
792+ utils .copytree (app_nw_folder , package_loc )
793+ utils .copy (nw_path , dest_binary_path )
794+ else :
795+ join_files (dest_binary_path , nw_path , zip_file )
796+ else :
797+ join_files (dest_binary_path , nw_path , zip_file )
788798
789799 sevenfivefive = (stat .S_IRWXU |
790800 stat .S_IRGRP |
0 commit comments