diff --git a/scripts/archive.js b/scripts/archive.js index 49e0a946..95629151 100644 --- a/scripts/archive.js +++ b/scripts/archive.js @@ -6,6 +6,11 @@ var child_process = require('child_process'); var path = require('path'); var fs = require('fs-extra'); +var helpers = require('./helpers'); + +function isApi64Bit(root_path) { + return helpers.fileExists(path.join(root_path, 'build', 'Release', 'loot64.dll')); +} function vulcanize() { return child_process.execFileSync('node', [ @@ -42,6 +47,12 @@ function createAppArchive(dest_path) { // Ensure that the output directory is empty. fs.emptyDirSync(temp_path); + if (helpers.isMultiArch(root_path)) { + var release_path = path.join(root_path, 'build', '32', 'Release'); + } else { + var release_path = path.join(root_path, 'build', 'Release'); + } + // Copy LOOT exectuable and CEF files. [ 'LOOT.exe', @@ -59,7 +70,7 @@ function createAppArchive(dest_path) { 'icudtl.dat' ].forEach(function(file){ fs.copySync( - path.join(root_path, 'build', 'Release', file), + path.join(release_path, file), path.join(temp_path, file) ); }); @@ -67,7 +78,7 @@ function createAppArchive(dest_path) { // CEF locale file. fs.mkdirsSync(path.join(temp_path, 'resources', 'l10n')); fs.copySync( - path.join(root_path, 'build', 'Release', 'resources', 'l10n', 'en-US.pak'), + path.join(release_path, 'resources', 'l10n', 'en-US.pak'), path.join(temp_path, 'resources', 'l10n', 'en-US.pak') ); @@ -86,7 +97,7 @@ function createAppArchive(dest_path) { // UI files. fs.mkdirsSync(path.join(temp_path, 'resources', 'ui', 'css')); fs.copySync( - path.join(root_path, 'build', 'Release', 'resources', 'ui', 'index.html'), + path.join(release_path, 'resources', 'ui', 'index.html'), path.join(temp_path, 'resources', 'ui', 'index.html') ); fs.copySync( @@ -123,11 +134,27 @@ function createApiArchive(dest_path) { // Ensure that the output directory is empty. fs.emptyDirSync(temp_path); - // API binary. - fs.copySync( - path.join(root_path, 'build', 'Release', 'loot32.dll'), - path.join(temp_path, 'loot32.dll') - ); + // API binary/binaries. + if (helpers.isMultiArch(root_path)) { + fs.copySync( + path.join(root_path, 'build', '32', 'Release', 'loot32.dll'), + path.join(temp_path, 'loot32.dll') + ); + fs.copySync( + path.join(root_path, 'build', '64', 'Release', 'loot64.dll'), + path.join(temp_path, 'loot64.dll') + ); + } else if (isApi64Bit(root_path)) { + fs.copySync( + path.join(root_path, 'build', 'Release', 'loot64.dll'), + path.join(temp_path, 'loot64.dll') + ); + } else { + fs.copySync( + path.join(root_path, 'build', 'Release', 'loot32.dll'), + path.join(temp_path, 'loot32.dll') + ); + } // API header file. fs.mkdirsSync(path.join(temp_path, 'include', 'loot')); diff --git a/scripts/helpers.js b/scripts/helpers.js new file mode 100644 index 00000000..af1fe996 --- /dev/null +++ b/scripts/helpers.js @@ -0,0 +1,24 @@ +// Helper functions shared across scripts. +var path = require('path'); +var fs = require('fs'); + +function fileExists(file_path) { + try { + // Query the entry + stats = fs.lstatSync(file_path); + + // Is it a directory? + if (stats.isFile()) { + return true; + } + } catch (e) {} + + return false; +} + +function isMultiArch(root_path) { + return fileExists(path.join(root_path, 'build', '64', 'Release', 'loot64.dll')); +} + +module.exports.fileExists = fileExists; +module.exports.isMultiArch = isMultiArch; diff --git a/scripts/installer.iss b/scripts/installer.iss index d6011047..7ea57df4 100644 --- a/scripts/installer.iss +++ b/scripts/installer.iss @@ -16,6 +16,12 @@ #define SimplifiedChineseExists #endif +#if FileExists(SourcePath + '..\build\32\Release\LOOT.exe') +#define buildir "build\32" +#else +#define buildir "build" +#endif + [Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. @@ -61,33 +67,33 @@ Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl" Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "build\Release\LOOT.exe"; \ +Source: "{#buildir}\Release\LOOT.exe"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\cef.pak"; \ +Source: "{#buildir}\Release\cef.pak"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\cef_100_percent.pak"; \ +Source: "{#buildir}\Release\cef_100_percent.pak"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\cef_200_percent.pak"; \ +Source: "{#buildir}\Release\cef_200_percent.pak"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\d3dcompiler_47.dll"; \ +Source: "{#buildir}\Release\d3dcompiler_47.dll"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\devtools_resources.pak"; \ +Source: "{#buildir}\Release\devtools_resources.pak"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\icudtl.dat"; \ +Source: "{#buildir}\Release\icudtl.dat"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\libcef.dll"; \ +Source: "{#buildir}\Release\libcef.dll"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\libEGL.dll"; \ +Source: "{#buildir}\Release\libEGL.dll"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\libGLESv2.dll"; \ +Source: "{#buildir}\Release\libGLESv2.dll"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\wow_helper.exe"; \ +Source: "{#buildir}\Release\wow_helper.exe"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\natives_blob.bin"; \ +Source: "{#buildir}\Release\natives_blob.bin"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\snapshot_blob.bin"; \ +Source: "{#buildir}\Release\snapshot_blob.bin"; \ DestDir: "{app}"; Flags: ignoreversion -Source: "build\Release\resources\l10n\en-US.pak"; \ +Source: "{#buildir}\Release\resources\l10n\en-US.pak"; \ DestDir: "{app}\resources\l10n"; Flags: ignoreversion Source: "docs\LOOT Metadata Syntax.html"; \ @@ -101,7 +107,7 @@ DestDir: "{app}\docs\images"; Flags: ignoreversion Source: "docs\images\settings.png"; \ DestDir: "{app}\docs\images"; Flags: ignoreversion -Source: "build\Release\resources\ui\index.html"; \ +Source: "{#buildir}\Release\resources\ui\index.html"; \ DestDir: "{app}\resources\ui"; Flags: ignoreversion Source: "resources\ui\css\dark-theme.css"; \ DestDir: "{app}\resources\ui\css"; Flags: ignoreversion diff --git a/scripts/vulcanize.js b/scripts/vulcanize.js index 36e73fda..23a3e592 100644 --- a/scripts/vulcanize.js +++ b/scripts/vulcanize.js @@ -4,13 +4,19 @@ var child_process = require('child_process'); var path = require('path'); var fs = require('fs'); +var helpers = require('./helpers'); if (process.argv.length < 3) { var root_path = '.'; } else { var root_path = process.argv[2]; } -var output_path = path.join(root_path, 'build', 'Release', 'resources', 'ui'); + +if (helpers.isMultiArch(root_path)) { + var output_path = path.join(root_path, 'build', '32', 'Release', 'resources', 'ui'); +} else { + var output_path = path.join(root_path, 'build', 'Release', 'resources', 'ui'); +} // Makes sure output directory exists first. try {