diff --git a/Web2Exe.nsi b/Web2Exe.nsi index 24491cc..bde4832 100644 --- a/Web2Exe.nsi +++ b/Web2Exe.nsi @@ -78,8 +78,12 @@ Section "Web2Executable" SEC01 SectionIn RO SetOutPath "$INSTDIR" SetOverwrite try - File /r "Web2ExeWin\" + File /r /x compressors "Web2ExeWin\" + CreateDirectory "$LocalAppData\Web2Executable\Web2Executable\files\compressors" + SetOutPath "$LocalAppData\Web2Executable\Web2Executable\files\compressors" + File "Web2ExeWin\files\compressors\upx-win.exe" + ; Shortcuts !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" diff --git a/command_line.py b/command_line.py index 60e6ab0..7bea3a3 100644 --- a/command_line.py +++ b/command_line.py @@ -65,6 +65,10 @@ def get_file(path): independent_path = utils.path_join(CWD, *parts) return independent_path +def is_installed(): + uninst = get_file('uninst.exe') + return utils.is_windows() and os.path.exists(uninst) + __version__ = "v0.0.0" with open(get_file('files/version.txt')) as f: @@ -842,6 +846,7 @@ def compress_nw(self, nw_path): compression = self.get_setting('nw_compression_level') if compression.value == 0: return + comp_dict = {'Darwin64bit': get_file('files/compressors/upx-mac'), 'Darwin32bit': get_file('files/compressors/upx-mac'), 'Linux64bit': get_file('files/compressors/upx-linux-x64'), @@ -850,6 +855,10 @@ def compress_nw(self, nw_path): 'Windows32bit': get_file('files/compressors/upx-win.exe') } + if is_installed(): + comp_dict['Windows64bit'] = get_data_file_path('files/compressors/upx-win.exe') + comp_dict['Windows32bit'] = get_data_file_path('files/compressors/upx-win.exe') + plat = platform.system()+platform.architecture()[0] upx_version = comp_dict.get(plat, None)