From caa0b2f3cf7be7f206d4b1cd381f14215647daa8 Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Tue, 6 Oct 2015 23:12:34 -0600 Subject: [PATCH] Added preliminary support for uncompressed folders on mac. --- command_line.py | 20 ++++++++++++++++---- files/settings.cfg | 7 ++++++- main.py | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/command_line.py b/command_line.py index 9e6a6e1..5a49275 100644 --- a/command_line.py +++ b/command_line.py @@ -638,6 +638,11 @@ class CommandBase(object): zip_file = os.path.join(temp_dir, self.project_name()+'.nw') + app_nw_folder = os.path.join(temp_dir, self.project_name()+'.nwf') + + shutil.copytree(self.project_dir(), app_nw_folder, + ignore=shutil.ignore_patterns(output_dir)) + zip_files(zip_file, self.project_dir(), exclude_paths=[output_dir]) for ex_setting in self.settings['export_settings'].values(): if ex_setting.value: @@ -662,6 +667,8 @@ class CommandBase(object): self.progress_text += '.' if 'mac' in ex_setting.name: + uncomp_setting = self.get_setting('uncompressed_folder') + uncompressed = uncomp_setting.value app_path = os.path.join(export_dest, self.project_name()+'.app') @@ -689,10 +696,15 @@ class CommandBase(object): self.progress_text += '.' - shutil.copy(zip_file, os.path.join(app_path, - 'Contents', - 'Resources', - 'app.nw')) + app_nw_res = os.path.join(app_path, + 'Contents', + 'Resources', + 'app.nw') + + if uncompressed: + shutil.copytree(app_nw_folder, app_nw_res) + else: + shutil.copy(zip_file, app_nw_res) self.create_icns_for_app(os.path.join(app_path, 'Contents', 'Resources', diff --git a/files/settings.cfg b/files/settings.cfg index d4683bf..3401eb3 100644 --- a/files/settings.cfg +++ b/files/settings.cfg @@ -337,6 +337,11 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64' max=9 type='range' description='Compression to be applied to the executable\'s nwjs binary. 0 is no compression, 9 is maximum. They all use lzma.' + [[uncompressed_folder]] + display_name='Uncompressed Folder' + type='check' + default_value=False + description='Mac OSX Only! This option makes the resulting app.nw inside the app just a plain folder. This is useful to mitigate startup times and to modify files.' [order] @@ -352,7 +357,7 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64' 'kiosk', 'kiosk_emulation', 'transparent']""" export_setting_order = """['windows-x32', 'windows-x64', 'mac-x32', 'mac-x64', 'linux-x64', 'linux-x32']""" - compression_setting_order = """['nw_compression_level']""" + compression_setting_order = """['nw_compression_level', 'uncompressed_folder']""" download_setting_order = """['nw_version', 'download_dir', 'force_download']""" diff --git a/main.py b/main.py index 2bf5db1..5301dda 100644 --- a/main.py +++ b/main.py @@ -860,7 +860,7 @@ class MainWindow(QtGui.QMainWindow, CommandBase): def create_compression_settings(self): group_box = QtGui.QWidget() - vlayout = self.create_layout(self.settings['order']['compression_setting_order'], cols=3) + vlayout = self.create_layout(self.settings['order']['compression_setting_order'], cols=1) warning_label = QtGui.QLabel('Note: When using compression (greater than 0) it will decrease the executable size,\nbut will increase the startup time when running it.') vbox = QtGui.QVBoxLayout() vbox.addLayout(vlayout)