Remove all GUI files and references to the GUI

As the NodeJS dependency no longer exists, the archive script has
been replaced with a CPack implementation, and the
set_version_number script turned into a Python script.
This commit is contained in:
Oliver Hamlet
2017-02-10 23:11:13 +00:00
parent 37e464f600
commit cf67649049
167 changed files with 140 additions and 32876 deletions
-22
View File
@@ -1,22 +0,0 @@
function DownloadLanguageFile($languageFile, $innoPath) {
$url = 'https://raw.github.com/jrsoftware/issrc/master/Files/Languages/Unofficial/' + $languageFile
$installPath = $innoPath + '\Languages\' + $languageFile
(New-Object System.Net.WebClient).DownloadFile($url, $installPath)
}
$innoInstallPath = 'C:\Program Files (x86)\Inno Setup 5'
# Install the Inno Download Plugin
$url = 'https://bitbucket.org/mitrich_k/inno-download-plugin/downloads/idpsetup-1.5.1.exe'
(New-Object System.Net.WebClient).DownloadFile($url, (pwd).path + '/idpsetup-1.5.1.exe')
./idpsetup-1.5.1.exe /verysilent
# Also install the unofficial Korean and Simplified Chinese translation
# files for Inno Setup.
DownloadLanguageFile '\Korean.isl' $innoInstallPath
DownloadLanguageFile '\ChineseSimplified.isl' $innoInstallPath
$env:PATH += ';' + $innoInstallPath
iscc scripts\installer.iss
@@ -1,23 +0,0 @@
function Get-BranchName() {
$numbers = $env:APPVEYOR_REPO_TAG_NAME.Split('.')
if ($numbers[0] -eq 0) {
$numbers = $numbers[0..($numbers.length - 2)]
} else {
$numbers = @($numbers[0])
}
return "v" + ($numbers -join '.')
}
if ($env:APPVEYOR_REPO_TAG -eq 'true') {
npm install -g lomad
$branchName = Get-BranchName
Write-Output "`nUpdating masterlists' default branch to $branchName..."
lomad -t $env:github_auth_token -a -d $branchName
if ($lastexitcode -eq 0) {
Write-Output "Masterlists' default branches have been updated."
}
}
-248
View File
@@ -1,248 +0,0 @@
#!/usr/bin/env node
// Archive packaging script. Takes one argument, which is the path to the
// repository's root. Requires 7-zip and Git to be installed, and Git to be
// available on the system path.
'use strict';
const childProcess = require('child_process');
const path = require('path');
const fs = require('fs-extra');
const os = require('os');
const helpers = require('./helpers');
function getGitDescription() {
const describe = String(helpers.safeExecFileSync('git', [
'describe',
'--tags',
'--long',
'--abbrev=7',
])).slice(0, -1);
let branch = String(helpers.safeExecFileSync('git', [
'rev-parse',
'--abbrev-ref',
'HEAD',
])).slice(0, -1);
/* On AppVeyor and Travis CI, a specific commit is checked out, so the branch
is HEAD. Use their stored branch value instead. */
if (branch === 'HEAD') {
if (process.env.APPVEYOR_REPO_BRANCH) {
branch = process.env.APPVEYOR_REPO_BRANCH;
} else if (process.env.TRAVIS_BRANCH) {
branch = process.env.TRAVIS_BRANCH;
}
}
return `${describe}_${branch}`;
}
function getLanguageFolders() {
return [
'es',
'ru',
'fr',
'zh_CN',
'pl',
'pt_BR',
'fi',
'de',
'da',
'ko',
'sv',
];
}
function compress(sourcePath, destPath) {
// First remove any existing archive.
fs.removeSync(destPath);
const filename = path.basename(destPath);
const rootFolder = path.basename(sourcePath);
const workingDirectory = path.dirname(sourcePath);
if (os.platform() === 'win32') {
let sevenzipPath = path.join('C:\\', 'Program Files', '7-Zip', '7z.exe');
if (!helpers.fileExists(sevenzipPath)) {
sevenzipPath = '7z';
}
// The last argument must have a leading dot for the subdirectory not to
// be present in the archive, but path.join removes it, so it's prefixed.
return helpers.safeExecFileSync(sevenzipPath, [
'a',
'-r',
filename,
rootFolder,
], {
cwd: workingDirectory,
});
}
return childProcess.execSync(`tar -cJf ${filename} ${rootFolder}`, {
cwd: workingDirectory,
});
}
function createAppArchive(rootPath, releasePath, tempPath, destPath) {
// Ensure that the output directory is empty.
fs.emptyDirSync(tempPath);
// Copy LOOT exectuable and CEF files.
let binaries = [];
if (os.platform() === 'win32') {
binaries = [
'LOOT.exe',
'loot_api.dll',
'chrome_elf.dll',
'd3dcompiler_47.dll',
'libEGL.dll',
'libGLESv2.dll',
'libcef.dll',
'natives_blob.bin',
'snapshot_blob.bin',
'cef.pak',
'cef_100_percent.pak',
'cef_200_percent.pak',
'devtools_resources.pak',
'icudtl.dat',
];
} else {
binaries = [
'LOOT',
'libloot_api.so',
'chrome-sandbox',
'libcef.so',
'natives_blob.bin',
'snapshot_blob.bin',
'cef.pak',
'cef_100_percent.pak',
'cef_200_percent.pak',
'devtools_resources.pak',
'icudtl.dat',
];
}
binaries.forEach((file) => {
fs.copySync(
path.join(releasePath, file),
path.join(tempPath, file)
);
});
// CEF locale file.
fs.mkdirsSync(path.join(tempPath, 'resources', 'l10n'));
fs.copySync(
path.join(releasePath, 'resources', 'l10n', 'en-US.pak'),
path.join(tempPath, 'resources', 'l10n', 'en-US.pak')
);
// Translation files.
getLanguageFolders().forEach((lang) => {
fs.mkdirsSync(path.join(tempPath, 'resources', 'l10n', lang, 'LC_MESSAGES'));
fs.copySync(
path.join(rootPath, 'resources', 'l10n', lang, 'LC_MESSAGES', 'loot.mo'),
path.join(tempPath, 'resources', 'l10n', lang, 'LC_MESSAGES', 'loot.mo')
);
});
// UI files.
fs.copySync(
path.join(releasePath, 'resources', 'ui'),
path.join(tempPath, 'resources', 'ui')
);
// Documentation.
fs.copySync(
path.join(rootPath, 'build', 'docs', 'html'),
path.join(tempPath, 'docs')
);
// Now compress the folder to a 7-zip archive.
compress(tempPath, destPath);
// Finally, delete the temporary folder.
fs.removeSync(tempPath);
}
function createApiArchive(rootPath, releasePath, tempPath, destPath) {
// Ensure that the output directory is empty.
fs.emptyDirSync(tempPath);
// API binary/binaries.
let binaries = [];
if (os.platform() === 'win32') {
binaries = [
'loot_api.dll',
'loot_api.lib',
];
} else {
binaries = [
'libloot_api.so',
];
}
binaries.forEach((file) => {
fs.copySync(
path.join(releasePath, file),
path.join(tempPath, file)
);
});
// API header files.
fs.mkdirsSync(path.join(tempPath, 'include'));
fs.copySync(
path.join(rootPath, 'include', 'loot'),
path.join(tempPath, 'include', 'loot')
);
// Documentation.
fs.copySync(
path.join(rootPath, 'build', 'docs', 'html'),
path.join(tempPath, 'docs')
);
// Now compress the folder to a 7-zip archive.
compress(tempPath, destPath);
// Finally, delete the temporary folder.
fs.removeSync(tempPath);
}
function getFilenameSuffix(label, gitDescription) {
if (label) {
return `${gitDescription}_${label}`;
} else if (process.env.APPVEYOR) {
return `${gitDescription}_${process.env.PLATFORM}`;
}
return `${gitDescription}`;
}
function getArchiveFileExtension() {
if (os.platform() === 'win32') {
return '.7z';
}
return '.tar.xz';
}
let rootPath = '.';
if (process.argv.length > 2) {
rootPath = process.argv[2];
}
const gitDesc = getGitDescription();
const fileExtension = getArchiveFileExtension();
helpers.getAppReleasePaths(rootPath).forEach(releasePath => {
const filename = `loot_${getFilenameSuffix(releasePath.label, gitDesc)}`;
createAppArchive(rootPath,
releasePath.path,
path.join(rootPath, 'build', filename),
path.join(rootPath, 'build', filename + fileExtension));
});
helpers.getApiBinaryPaths(rootPath).forEach(binaryPath => {
const filename = `loot-api_${getFilenameSuffix(binaryPath.label, gitDesc)}`;
createApiArchive(rootPath,
binaryPath.path,
path.join(rootPath, 'build', filename),
path.join(rootPath, 'build', filename + fileExtension));
});
-121
View File
@@ -1,121 +0,0 @@
'use strict';
const helpers = require('./helpers');
const hyd = require('hydrolysis');
const fs = require('fs-extra');
const path = require('path');
const getRobotoFiles = require('./get_roboto_files').getRobotoFiles;
function handleError(error) {
console.error(error);
process.exit(1);
}
function getHtmlImports(filePath) {
return hyd.Analyzer.analyze(filePath).then((analyzer) =>
analyzer._getDependencies(filePath)
);
}
function isString(variable) {
return typeof variable === 'string' || variable instanceof String;
}
function flattenUnique(array) {
const results = new Set();
array.forEach((element) => {
if (isString(element)) {
results.add(element);
} else if (element) {
flattenUnique(element).forEach((subelement) => {
results.add(subelement);
});
}
});
return results;
}
function getRecursiveHtmlImports(filePath, imports) {
return getHtmlImports(filePath).then((paths) =>
Promise.all(paths.map((dependency) => {
if (imports.has(dependency)) {
return null;
}
imports.add(dependency);
return getRecursiveHtmlImports(dependency, imports);
}))
).then((results) => {
flattenUnique(results).forEach((dependency) => {
imports.add(dependency);
});
return imports;
});
}
function getJavaScriptSources(filePath) {
return hyd.Analyzer.analyze(filePath).then((analyzer) =>
Object.keys(analyzer.parsedScripts).filter((script) =>
script.endsWith('.js')
)
);
}
function getRelativePath(filePath) {
if (filePath.startsWith('src/gui/html/')) {
return filePath.substring(13);
}
return filePath;
}
function normalisePaths(html) {
return html.replace(/href="(\.\.\/){3}/g, 'href="')
.replace(/src="(\.\.\/){3}/g, 'src="');
}
function copyNormalisedFile(sourceFile, destinationFile) {
const html = fs.readFileSync(sourceFile, { encoding: 'utf8' });
fs.mkdirsSync(path.dirname(destinationFile));
fs.writeFileSync(destinationFile, normalisePaths(html));
}
function copyFiles(pathsPromise, destinationRootPath) {
pathsPromise.then((paths) => {
paths.forEach((filePath) => {
const destinationPath = `${destinationRootPath}/${getRelativePath(filePath)}`;
if (filePath.includes('bower_components')) {
fs.copySync(filePath, destinationPath);
} else {
copyNormalisedFile(filePath, destinationPath);
}
});
}).catch(handleError);
}
const url = 'https://github.com/google/roboto/releases/download/v2.135/roboto-hinted.zip';
const fontsPath = 'build/fonts';
Promise.resolve().then(() => {
if (!fs.existsSync(fontsPath)) {
return getRobotoFiles(url, fontsPath);
}
return '';
}).then(() => {
helpers.getAppReleasePaths('.').forEach(releasePath => {
const index = 'src/gui/html/index.html';
const destinationRootPath = `${releasePath.path}/resources/ui`;
const imports = new Set();
copyFiles(getRecursiveHtmlImports(index, imports), destinationRootPath);
copyFiles(getJavaScriptSources(index), destinationRootPath);
fs.copySync('src/gui/html/css', `${destinationRootPath}/css`);
fs.copySync('resources/ui/css/dark-theme.css', `${destinationRootPath}/css/dark-theme.css`);
fs.copySync(fontsPath, `${destinationRootPath}/fonts`);
copyNormalisedFile(index, `${destinationRootPath}/index.html`);
// This is the only JS file referenced by a HTML import (neon-animation),
// so just hardcode it instead of recursively searching for it.
const webAnimationsJs = 'bower_components/web-animations-js/web-animations-next-lite.min.js';
fs.copySync(webAnimationsJs, `${destinationRootPath}/${webAnimationsJs}`);
});
}).catch(handleError);
-25
View File
@@ -1,25 +0,0 @@
# Set CEF_PATH to the path to the root of the CEF folder that contains the
# files to be edited.
# Remove the "add_subdirectory(cefclient)" and "add_subdirectory(cefsimple)"
# lines from CEF's CMakeLists.txt.
set(CEF_CMAKELISTS_PATH "CMakeLists.txt")
file(READ ${CEF_CMAKELISTS_PATH} CEF_CMAKELISTS)
string(REPLACE "add_subdirectory(cefclient)" "" CEF_CMAKELISTS ${CEF_CMAKELISTS})
string(REPLACE "add_subdirectory(cefsimple)" "" CEF_CMAKELISTS ${CEF_CMAKELISTS})
string(REGEX REPLACE "add_subdirectory\\(tests/.+\\)" "" CEF_CMAKELISTS ${CEF_CMAKELISTS})
file(WRITE ${CEF_CMAKELISTS_PATH} ${CEF_CMAKELISTS})
message("MSVC_STATIC_RUNTIME: ${MSVC_STATIC_RUNTIME}")
if (NOT MSVC_STATIC_RUNTIME)
# Replace the "/MT" and "/MTd" linker flags with "/MD" and "/MDd".
set(CEF_VARIABLES_PATH "cmake/cef_variables.cmake")
file(READ ${CEF_VARIABLES_PATH} CEF_VARIABLES)
string(REPLACE "/MT" "/MD" CEF_VARIABLES ${CEF_VARIABLES})
file(WRITE ${CEF_VARIABLES_PATH} ${CEF_VARIABLES})
endif ()
-32
View File
@@ -1,32 +0,0 @@
const helpers = require('./helpers');
const fs = require('fs-extra');
const path = require('path');
const svgPath = path.join('resources', 'icon.svg');
const buildDirectory = path.join('build', 'icon');
const outputPath = path.join(buildDirectory, 'icon.ico');
const svgSize = 192;
const svgDPI = 90;
const sizes = [16, 20, 24, 30, 32, 36, 40, 48, 60, 64, 72, 80, 96, 128, 256];
fs.mkdirsSync(buildDirectory);
const convertArgs = [];
sizes.forEach((size) => {
const pngFile = path.join(buildDirectory, `icon-${size}.png`);
convertArgs.push(pngFile);
helpers.safeExecFileSync('convert', [
'-density',
(size / svgSize) * svgDPI,
'-background',
'none',
svgPath,
pngFile,
]);
});
convertArgs.push(outputPath);
helpers.safeExecFileSync('convert', convertArgs);
-26
View File
@@ -1,26 +0,0 @@
const fs = require('fs-extra');
const path = require('path');
const request = require('request');
const decompress = require('decompress');
const decompressUnzip = require('decompress-unzip');
function getRobotoFiles(url, destinationPath) {
const extractPath = path.dirname(destinationPath);
const downloadPath = path.join(extractPath, 'roboto-hinted.zip');
return new Promise((resolve, reject) => {
request(url)
.pipe(fs.createWriteStream(downloadPath))
.on('close', (err) => {
if (err) {
reject(err);
}
resolve();
});
}).then(() => decompress(downloadPath, extractPath)).then(() => {
fs.renameSync(path.join(extractPath, 'roboto-hinted'), destinationPath);
fs.removeSync(downloadPath);
});
}
module.exports.getRobotoFiles = getRobotoFiles;
-19
View File
@@ -1,19 +0,0 @@
#!/bin/sh
# This is a Git pre-commit hook. Install it to `.git/hooks`.
#
# Run xgettext to write a new resources/l10n/template.pot, then add it to the
# commit if more than one line in it has changed, otherwise discard any changes
# to it.
xgettext --keyword="translate:1,1t" --keyword="translate:1,2,3t" --keyword="translateFormatted:1" --add-location=full --from-code=utf-8 --package-name=LOOT --package-version=0.10.3 --copyright-holder="WrinklyNinja" --msgid-bugs-address="https://github.com/loot/loot/issues" -o resources/l10n/template.pot src/gui/html/js/*.* src/gui/*.cpp src/gui/query/*.h src/gui/*/*.cpp src/api/*/*.* src/api/*.*
sed -i 's|charset=CHARSET|charset=UTF-8|' resources/l10n/template.pot
LINES_ADDED=$(git diff --numstat resources/l10n/template.pot | cut -f 1)
LINES_REMOVED=$(git diff --numstat resources/l10n/template.pot | cut -f 2)
if [ "$LINES_ADDED" = "$LINES_REMOVED" -a "$LINES_ADDED" = "1" ]; then
git checkout -- resources/l10n/template.pot
else
git add resources/l10n/template.pot
fi
-93
View File
@@ -1,93 +0,0 @@
// Helper functions shared across scripts.
'use strict';
const childProcess = require('child_process');
const path = require('path');
const fs = require('fs');
const os = require('os');
function fileExists(filePath) {
try {
// Query the entry
const stats = fs.lstatSync(filePath);
// Is it a directory?
if (stats.isFile()) {
return true;
}
} catch (e) {
/* Don't do anything, it's not an error. */
}
return false;
}
function getBinaryParentPaths(rootPath) {
const paths = [
{
path: path.join(rootPath, 'build'),
label: null,
},
{
path: path.join(rootPath, 'build', '32'),
label: '32-bit',
},
{
path: path.join(rootPath, 'build', '64'),
label: '64-bit',
},
];
if (os.platform() === 'win32') {
paths.forEach(parentPath => {
parentPath.path = path.join(parentPath.path, 'Release');
});
}
return paths;
}
function getAppReleasePaths(rootPath) {
let file = 'LOOT';
if (os.platform() === 'win32') {
file += '.exe';
}
return getBinaryParentPaths(rootPath).filter(
parentPath => fileExists(path.join(parentPath.path, file))
);
}
function getBinaryPaths(rootPath, file) {
return getBinaryParentPaths(rootPath)
.map(parentPath => {
parentPath.path = path.join(parentPath.path, file);
return parentPath;
})
.filter(parentPath => fileExists(parentPath.path));
}
function getApiBinaryPaths(rootPath) {
let file = 'loot_api';
if (os.platform() === 'win32') {
file += '.dll';
} else {
file = `lib${file}.so`;
}
return getBinaryParentPaths(rootPath).filter(
parentPath => fileExists(path.join(parentPath.path, file))
);
}
function safeExecFileSync(file, args, options) {
try {
return childProcess.execFileSync(file, args, options);
} catch (error) {
throw new Error(error.message);
}
}
module.exports.fileExists = fileExists;
module.exports.getAppReleasePaths = getAppReleasePaths;
module.exports.getApiBinaryPaths = getApiBinaryPaths;
module.exports.safeExecFileSync = safeExecFileSync;
-315
View File
@@ -1,315 +0,0 @@
; LOOT installer Inno Setup script.
; This file must be encoded in UTF-8 WITH a BOM for Unicode text to
; be displayed correctly.
#include <idp.iss>
#include <idplang\finnish.iss>
#include <idplang\french.iss>
#include <idplang\german.iss>
#include <idplang\polish.iss>
#include <idplang\russian.iss>
#include <idplang\spanish.iss>
#define MyAppName "LOOT"
#define MyAppVersion "0.10.3"
#define MyAppPublisher "LOOT Team"
#define MyAppURL "https://loot.github.io"
#define MyAppExeName "LOOT.exe"
#if FileExists(AddBackslash(CompilerPath) + 'Languages\Korean.isl')
#define KoreanExists
#endif
#if FileExists(AddBackslash(CompilerPath) + 'Languages\ChineseSimplified.isl')
#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.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{BF634210-A0D4-443F-A657-0DCE38040374}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppCopyright=Copyright (C) 2009-2016 {#MyAppPublisher}
DefaultDirName={pf}\{#MyAppName}
SourceDir=..\
OutputBaseFilename=LOOT Installer
OutputDir=build
SetupIconFile=build\icon\icon.ico
Compression=lzma
SolidCompression=yes
DisableDirPage=no
DisableReadyPage=yes
DisableProgramGroupPage=yes
[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "pt_BR"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "da"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "fi"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "fr"; MessagesFile: "compiler:Languages\French.isl"
Name: "de"; MessagesFile: "compiler:Languages\German.isl"
#ifdef KoreanExists
Name: "ko"; MessagesFile: "compiler:Languages\Korean.isl"
#endif
Name: "pl"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"
#ifdef SimplifiedChineseExists
Name: "zh_CN"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
#endif
Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#buildir}\Release\LOOT.exe"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\cef.pak"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\cef_100_percent.pak"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\cef_200_percent.pak"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\d3dcompiler_47.dll"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\devtools_resources.pak"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\icudtl.dat"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\chrome_elf.dll"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\libcef.dll"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\libEGL.dll"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\libGLESv2.dll"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\natives_blob.bin"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\snapshot_blob.bin"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "{#buildir}\Release\resources\l10n\en-US.pak"; \
DestDir: "{app}\resources\l10n"; Flags: ignoreversion
Source: "{#buildir}\docs\html\*"; \
DestDir: "{app}\docs"; Flags: ignoreversion recursesubdirs
Source: "{#buildir}\Release\resources\ui\*"; \
DestDir: "{app}\resources\ui"; Flags: ignoreversion recursesubdirs
Source: "resources\l10n\da\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\da\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\de\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\de\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\es\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\es\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\fi\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\fi\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\fr\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\fr\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\ko\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\ko\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\pl\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\pl\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\pt_BR\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\pt_BR\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\ru\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\ru\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\sv\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\sv\LC_MESSAGES"; Flags: ignoreversion
Source: "resources\l10n\zh_CN\LC_MESSAGES\loot.mo"; \
DestDir: "{app}\resources\l10n\zh_CN\LC_MESSAGES"; Flags: ignoreversion
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Filename: "{tmp}\vc_redist.x86.exe"; Parameters: "/quiet /norestart"; Flags: skipifdoesntexist
[Registry]
; Store install path for backwards-compatibility with old NSIS install script behaviour.
Root: HKLM; Subkey: "Software\LOOT"; ValueType: string; ValueName: "Installed Path"; ValueData: "{app}"; Flags: deletekey uninsdeletekey
[UninstallDelete]
Type: files; Name: "{localappdata}\{#MyAppName}\";
Type: files; Name: "{localappdata}\{#MyAppName}\";
Type: files; Name: "{localappdata}\{#MyAppName}\Oblivion\masterlist.yaml";
Type: files; Name: "{localappdata}\{#MyAppName}\Skyrim\masterlist.yaml";
Type: files; Name: "{localappdata}\{#MyAppName}\Fallout3\masterlist.yaml";
Type: files; Name: "{localappdata}\{#MyAppName}\FalloutNV\masterlist.yaml";
Type: files; Name: "{localappdata}\{#MyAppName}\Fallout4\masterlist.yaml";
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Oblivion\.git";
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Skyrim\.git";
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Fallout3\.git";
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\FalloutNV\.git";
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Fallout4\.git";
Type: dirifempty; Name: "{localappdata}\{#MyAppName}\Oblivion";
Type: dirifempty; Name: "{localappdata}\{#MyAppName}\Skyrim";
Type: dirifempty; Name: "{localappdata}\{#MyAppName}\Fallout3";
Type: dirifempty; Name: "{localappdata}\{#MyAppName}\FalloutNV";
Type: dirifempty; Name: "{localappdata}\{#MyAppName}\Fallout4";
Type: dirifempty; Name: "{localappdata}\{#MyAppName}";
[CustomMessages]
en.DeleteUserFiles=Do you want to delete your settings and user metadata?
;pt_BR.DeleteUserFiles=
da.DeleteUserFiles=Ønsker du at slette dine indstillinger og bruger metadata?
fi.DeleteUserFiles=Haluatko poistaa asetukset ja käyttäjä metatiedot?
fr.DeleteUserFiles=Voulez-vous supprimer vos paramètres et les métadonnées de l'utilisateur?
de.DeleteUserFiles=Möchten Sie Ihre Einstellungen und Benutzer-Metadaten löschen?
#ifdef KoreanExists
ko.DeleteUserFiles=당신은 당신의 설정과 사용자 메타 데이터를 삭제 하시겠습니까?
#endif
pl.DeleteUserFiles=Czy chcesz usunąć ustawienia i metadane użytkownika?
ru.DeleteUserFiles=Вы хотите удалить ваши настройки и метаданные пользователя?
#ifdef SimplifiedChineseExists
zh_CN.DeleteUserFiles=你想要删除你的设置和用户数据吗?
#endif
es.DeleteUserFiles=¿Quieres borrar sus ajustes y metadatos de usuario?
[Code]
// Set LOOT's language in settings.yaml
procedure SetLootLanguage();
var
LanguageLine: String;
File: String;
SearchLineStart: String;
Lines: TArrayOfString;
I: Integer;
begin
LanguageLine := 'language: ' + ActiveLanguage;
File := ExpandConstant('{localappdata}\{#MyAppName}\settings.yaml');
if FileExists(File) then begin
SearchLineStart := 'language:';
if LoadStringsFromFile(File, Lines) = True then begin
for I := 0 to GetArrayLength(Lines) - 1 do begin
if Copy(Lines[I], 0, Length(SearchLineStart)) = SearchLineStart then begin
Lines[I] := LanguageLine;
SaveStringsToUTF8File(File, Lines, False)
Break;
end;
end;
end;
end
else begin
if ActiveLanguage <> 'en' then
SaveStringToFile(File, LanguageLine, False);
end;
end;
// Run a previous install's uninstaller before starting this installation.
procedure RunPreviousVersionUninstaller();
var
RegKey: String;
RegValue: String;
ResultCode: Integer;
begin
// First try using the Inno Setup installer's uninstall Registry key to get
// the uninstaller's path. This is necessary instead of just using the
// backwards-compatible key because the filename of the uninstaller created
// by Inno Setup can vary.
RegKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
if RegQueryStringValue(HKLM, RegKey, 'UninstallString', RegValue) then begin
Exec(RemoveQuotes(RegValue), '/VERYSILENT', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
// Now try using the backwards-compatible Registry key, and run the NSIS
// uninstaller, which has a fixed filename.
end
else begin
if RegQueryStringValue(HKLM, 'Software\LOOT', 'Installed Path', RegValue) then begin
Exec(RegValue + '\Uninstall.exe', '/S', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
function VCRedistNeedsInstall: Boolean;
var
VersionMajor : Integer;
VersionMinor: Integer;
VersionBld: Integer;
RegKey: String;
IsRuntimeInstalled: Cardinal;
InstalledVersionMajor: Cardinal;
InstalledVersionMinor: Cardinal;
InstalledVersionBld: Cardinal;
begin
VersionMajor := 14;
VersionMinor := 0;
VersionBld := 24215;
RegKey := 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86';
IsRuntimeInstalled := 0;
InstalledVersionMajor := 0;
InstalledVersionMinor := 0;
InstalledVersionBld := 0;
RegQueryDWordValue(HKLM, RegKey, 'Installed', IsRuntimeInstalled);
RegQueryDWordValue(HKLM, RegKey, 'Major', InstalledVersionMajor);
RegQueryDWordValue(HKLM, RegKey, 'Minor', InstalledVersionMinor);
RegQueryDWordValue(HKLM, RegKey, 'Bld', InstalledVersionBld);
Result := (IsRuntimeInstalled = 0)
or (InstalledVersionMajor < VersionMajor)
or (InstalledVersionMinor < VersionMinor)
or (InstalledVersionBld < VersionBld);
end;
// Query user whether their data files should be deleted on uninstall.
procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
begin
// Don't remove user data if the uninstall is silent.
if UninstallSilent then
exit;
if CurUninstallStep = usUninstall then begin
if MsgBox(CustomMessage('DeleteUserFiles'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES
then begin
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\LOOTDebugLog.txt'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\CEFDebugLog.txt'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\settings.yaml'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Oblivion\userlist.yaml'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Skyrim\userlist.yaml'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Fallout3\userlist.yaml'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\FalloutNV\userlist.yaml'));
DeleteFile(ExpandConstant('{localappdata}\{#MyAppName}\Fallout4\userlist.yaml'));
end;
end;
end;
procedure InitializeWizard();
begin
if VCRedistNeedsInstall then begin
idpAddFile('https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x86.exe', ExpandConstant('{tmp}\vc_redist.x86.exe'));
idpDownloadAfter(wpReady);
end
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
RunPreviousVersionUninstaller();
if CurStep = ssPostInstall then begin
SetLootLanguage();
DeleteFile(ExpandConstant('{tmp}\vc_redist.x86.exe'));
end
end;
-33
View File
@@ -1,33 +0,0 @@
/* Convert .po files to .mo files. */
/* eslint-disable no-unused-vars */
'use strict';
const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');
const helpers = require('./helpers');
let rootPath = '.';
if (process.argv.length > 2) {
rootPath = process.argv[2];
}
const l10nPath = path.join(rootPath, 'resources', 'l10n');
fs.readdirSync(l10nPath).forEach((file) => {
if (fs.statSync(path.join(l10nPath, file)).isDirectory()) {
try {
const poPath = path.join(l10nPath, file, 'LC_MESSAGES', 'loot.po');
const moPath = path.join(l10nPath, file, 'LC_MESSAGES', 'loot.mo');
fs.accessSync(poPath, fs.R_OK);
helpers.safeExecFileSync('msgfmt', [
poPath,
'-o',
moPath,
]);
} catch (error) {
console.log(error);
}
}
});
-92
View File
@@ -1,92 +0,0 @@
#! /usr/bin/env node
'use strict';
const path = require('path');
const replace = require('replace');
function updatePreCommitHookScript(version) {
replace({
regex: /--package-version=[\d.]+/,
replacement: `--package-version=${version}`,
paths: [path.join('scripts', 'git', 'pre-commit')],
silent: true,
});
}
function updateInstallerScript(version) {
replace({
regex: /#define MyAppVersion "[\d.]+"/,
replacement: `#define MyAppVersion "${version}"`,
paths: [path.join('scripts', 'installer.iss')],
silent: true,
});
}
function updateCppFile(version) {
const file = path.join('src', 'api', 'loot_version.cpp.in');
const versionParts = version.split('.');
replace({
regex: /LootVersion::major = \d+;/,
replacement: `LootVersion::major = ${versionParts[0]};`,
paths: [file],
silent: true,
});
replace({
regex: /LootVersion::minor = \d+;/,
replacement: `LootVersion::minor = ${versionParts[1]};`,
paths: [file],
silent: true,
});
replace({
regex: /LootVersion::patch = \d+;/,
replacement: `LootVersion::patch = ${versionParts[2]};`,
paths: [file],
silent: true,
});
}
function updateResourceFiles(version) {
const files = [
path.join('src', 'api', 'resource.rc'),
path.join('src', 'gui', 'resource.rc'),
];
const commaSeparatedVersion = version.replace(/\./g, ', ');
replace({
regex: /VERSION \d+, \d+, \d+/g,
replacement: `VERSION ${commaSeparatedVersion}`,
paths: files,
silent: true,
});
replace({
regex: /Version", "\d+\.\d+\.\d+"/g,
replacement: `Version", "${version}"`,
paths: files,
silent: true,
});
}
function main() {
if (process.argv.length !== 3) {
console.error('Invalid number of arguments given. Only one argument (the new version number) is expected.');
process.exit(1);
}
const newVersion = process.argv[2];
if (newVersion.split('.').length !== 3) {
console.error('The version number must be a three-part semantic version.');
process.exit(1);
}
updatePreCommitHookScript(newVersion);
updateInstallerScript(newVersion);
updateCppFile(newVersion);
updateResourceFiles(newVersion);
}
main();
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import re
def replace_in_file(path, regex, replacement):
regex = re.compile(regex)
lines = []
with open(path) as infile:
for line in infile:
lines.append(re.sub(regex, replacement, line))
with open(path, 'w') as outfile:
for line in lines:
outfile.write(line)
def update_cpp_file(path, version):
version_parts = version.split('.')
replace_in_file(path, 'LootVersion::major = \d+;', 'LootVersion::major = {};'.format(version_parts[0]))
replace_in_file(path, 'LootVersion::minor = \d+;', 'LootVersion::minor = {};'.format(version_parts[1]))
replace_in_file(path, 'LootVersion::patch = \d+;', 'LootVersion::patch = {};'.format(version_parts[2]))
def update_resource_file(path, version):
comma_separated_version = version.replace('.', ', ')
replace_in_file(path, 'VERSION \d+, \d+, \d+', 'VERSION {}'.format(comma_separated_version))
replace_in_file(path, 'Version", "\d+\.\d+\.\d+"', 'VERSION ", "{}"'.format(version))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description = 'Set the LOOT API version number')
parser.add_argument('version', nargs='+')
arguments = parser.parse_args()
if len(arguments.version) != 1:
raise RuntimeError('Invalid number of arguments given. Only one argument (the new version number) is expected.')
if len(arguments.version[0].split('.')) != 3:
raise RuntimeError('The version number must be a three-part semantic version.')
update_cpp_file(os.path.join('src', 'api', 'loot_version.cpp.in'), arguments.version[0])
update_resource_file(os.path.join('src', 'api', 'resource.rc'), arguments.version[0])
+1 -1
View File
@@ -8,7 +8,7 @@
"name": "REPLACE_THIS_VERSION"
},
"files": [{
"includePattern": "build/(loot-api_.+\\.tar.xz)",
"includePattern": "build/package/(loot_api-.+\\.tar.xz)",
"uploadPattern": "$1"
}],
"publish": true
-15
View File
@@ -1,15 +0,0 @@
{
"package": {
"name": "loot",
"repo": "loot",
"subject": "wrinklyninja"
},
"version": {
"name": "REPLACE_THIS_VERSION"
},
"files": [{
"includePattern": "build/(loot_.+\\.tar.xz)",
"uploadPattern": "$1"
}],
"publish": true
}