Merge pull request #2 from loot/dev

update from oirgin
This commit is contained in:
S猫
2016-09-18 11:54:33 +08:00
committed by GitHub
26 changed files with 879 additions and 233 deletions
+11 -9
View File
@@ -5,25 +5,27 @@ env:
node: true
browser: true
ecmaFeatures:
modules: false
globals:
loot: false
should: false
extends:
- "eslint:recommended"
- "airbnb/base"
- "airbnb-base"
rules:
strict:
- 2
- global
strict: off
no-param-reassign:
- 2
- error
- props: false
max-len: 1
max-len: warn
linebreak-style: off
no-underscore-dangle: off
arrow-parens: off
no-undef: warn
no-mixed-operators:
- error
- allowSamePrecedence: true
plugins:
- eslint-plugin-html
+674
View File
File diff suppressed because it is too large Load Diff
+12 -6
View File
@@ -25,17 +25,19 @@ For example `LOOT v0.7.0-alpha-2-10-gf6d7e80_dev.7z` was built using the revisio
## Building LOOT
LOOT's build process uses [CMake](https://cmake.org). Most of LOOT's C++ dependencies are managed by CMake, but the following must be obtained manually:
### Windows
* [Boost](http://www.boost.org) v1.55+
Refer to `appveyor.yml` for the build process. The Appveyor configuration assumes that [CMake](https://cmake.org) and [Node.js](https://nodejs.org/) are already installed.
Building LOOT's GUI also uses [Node.js](https://nodejs.org/). With it installed, run `npm install` then `node_modules/.bin/bower install` from the repository root to install the additional tools and dependencies required.
### Linux
The GUI's HTML file is automatically built when building the LOOT GUI binary, but it can also be built by running `node scripts/vulcanize.js` from the repository root.
Refer to `.travis.yml` for the build process. If starting from a freshly-installed instance of Ubuntu Server 12.04, first run the steps in the `scripts/linux/prepare_ubuntu_precise.sh` to install some additional packages Travis instances have pre-installed.
Platform-specific instructions for building Windows binaries using Microsoft Visual Studio are given in [docs/BUILD.MSVC.md](docs/BUILD.MSVC.md), and instructions for building Linux binaries using GCC are given in [docs/BUILD.LINUX.md](docs/BUILD.LINUX.md).
Not all LOOT's features have been implemented for Linux builds. Issues labelled
`linux` on LOOT's issue tracker cover such missing features where they can be
implemented.
#### CMake Variables
### CMake Variables
LOOT uses the following CMake variables to set build parameters:
@@ -46,6 +48,10 @@ Parameter | Values | Default |Description
You may also need to set `BOOST_ROOT` if CMake cannot find Boost.
### Rebuilding the HTML UI
The GUI's HTML file is automatically built when building the LOOT GUI binary, but it can also be built by running `node scripts/vulcanize.js` from the repository root.
## Building The API Documentation
The API documentation is built using [Doxygen](http://www.stack.nl/~dimitri/doxygen/), [Breathe](https://breathe.readthedocs.io/en/latest/) and [Sphinx](http://www.sphinx-doc.org/en/stable/). On Windows, install Doxygen and [Python](https://www.python.org) 2.7, add Doxygen's binary path, `C:\Python27` and `C:\Python27\Scripts` (or wherever you installed Python to) to your `%PATH%`, then:
-44
View File
@@ -1,44 +0,0 @@
# Build Instructions using GCC
Linux binaries can be built for LOOT, and these instructions are for doing so on
Ubuntu 12.04, though they may also apply to other versions and
distributions.
## Building
Most of the procedure for building the API, tests and metadata validator can be
found in the `.travis.yml` file, which is the configuration file for LOOT's
Travis CI instance. However, Travis instances have a few more libraries and
utilities by default than Ubuntu 12.04 does, so installation of them will be
covered here.
Linux builds of the GUI application should be considered officially
**unsupported and unmaintained**, though contributions are welcome.
## Installing Missing Dependencies
### Base Dependencies
```
sudo apt-get install python-software-properties git build-essential libcurl4-openssl-dev
```
### UI Dependencies
```
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280
sudo apt-add-repository 'deb https://deb.nodesource.com/node_4.x precise main'
sudo apt-get update
sudo apt-get install nodejs
```
## Runtime Differences
Not all LOOT's features have been implemented for Linux builds. Issues labelled
`linux` on LOOT's issue tracker cover such missing features where they can be
implemented. Unavoidable platform differences are documented here:
* On Windows, LOOT can detect game installs using their Registry entries. On
Linux this is obviously not possible, so either game paths will have to be
entered manually in LOOT's settings dialog when it is run, or LOOT will need
to be installed beside a game's Data folder for that game to be detected.
-19
View File
@@ -1,19 +0,0 @@
# Build Instructions using Microsoft Visual C++
These instructions were used to build LOOT using Microsoft Visual Studio 2015 Community, though they should apply to other versions of MSVC.
#### Boost
```
bootstrap.bat
b2 toolset=msvc threadapi=win32 link=static runtime-link=static variant=release address-model=32 --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --with-iostreams
```
`link`, `runtime-link` and `address-model` can all be modified if shared linking or 64 bit builds are desired. LOOT uses statically-linked Boost libraries by default: to change this, edit [CMakeLists.txt](../CMakeLists.txt).
#### LOOT
1. Set CMake up so that it builds the binaries in the `build` subdirectory of the LOOT folder.
2. Define any necessary parameters.
3. Configure CMake, then generate a build system for Visual Studio.
4. Open the generated solution file, and build it.
+12 -9
View File
@@ -12,21 +12,24 @@
},
"homepage": "https://github.com/loot/loot",
"private": true,
"dependencies": {
"fs-extra": "^0.30.0",
"vulcanize": "^1.14.5"
},
"devDependencies": {
"bower": "^1.7.1",
"eslint": "^2.4.0",
"eslint-config-airbnb": "^6.1.0",
"eslint-plugin-html": "^1.3.0",
"fs-extra": "^0.26.2",
"grunt": "^0.4.5",
"eslint": "^3.5.0",
"eslint-config-airbnb-base": "^7.1.0",
"eslint-plugin-import": "^1.15.0",
"eslint-plugin-html": "^1.5.0",
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-contrib-connect": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-saucelabs": "^8.6.2",
"grunt-saucelabs": "^9.0.0",
"mkdirp": "^0.5.1",
"mocha": "^2.3.4",
"should": "^8.0.1",
"vulcanize": "^1.14.5"
"mocha": "^3.0.1",
"should": "^11.1.0"
},
"scripts": {
"test": "grunt test"
+29 -55
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LOOT 0.9.2\n"
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
"POT-Creation-Date: 2016-09-10 10:52+0100\n"
"POT-Creation-Date: 2016-09-14 18:51+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,64 +17,64 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/gui/html/js/events.js:16
#: src/gui/html/js/events.js:18
msgid "Identifying conflicting plugins..."
msgstr ""
#: src/gui/html/js/events.js:96
#: src/gui/html/js/events.js:100
msgid "No masterlist update was necessary."
msgstr ""
#: src/gui/html/js/events.js:146
#: src/gui/html/js/events.js:150
msgid "Sorting made no changes to the load order."
msgstr ""
#: src/gui/html/js/events.js:178
#: src/gui/html/js/events.js:182
msgid "Redate Plugins?"
msgstr ""
#: src/gui/html/js/events.js:178
#: src/gui/html/js/events.js:182
msgid ""
"This feature is provided so that modders using the Creation Kit may set the "
"load order it uses. A side-effect is that any subscribed Steam Workshop mods "
"will be re-downloaded by Steam. Do you wish to continue?"
msgstr ""
#: src/gui/html/js/events.js:178
#: src/gui/html/js/events.js:182
msgid "Redate"
msgstr ""
#: src/gui/html/js/events.js:187
#: src/gui/html/js/events.js:191
msgid ""
"Are you sure you want to clear all existing user-added metadata from all "
"plugins?"
msgstr ""
#: src/gui/html/js/events.js:187 src/gui/html/js/events.js:395
#: src/gui/html/js/events.js:191 src/gui/html/js/events.js:401
msgid "Clear"
msgstr ""
#: src/gui/html/js/events.js:198
#: src/gui/html/js/events.js:202
msgid "All user-added metadata has been cleared."
msgstr ""
#: src/gui/html/js/events.js:221
#: src/gui/html/js/events.js:225
msgid "LOOT's content has been copied to the clipboard."
msgstr ""
#: src/gui/html/js/events.js:232
#: src/gui/html/js/events.js:236
msgid "The load order has been copied to the clipboard."
msgstr ""
#: src/gui/html/js/events.js:263 src/gui/html/js/translateStaticText.js:195
#: src/gui/html/js/events.js:267 src/gui/html/js/translateStaticText.js:195
msgid "Quit"
msgstr ""
#: src/gui/html/js/events.js:275
#: src/gui/html/js/events.js:279
msgid "sorted load order"
msgstr ""
#: src/gui/html/js/events.js:277
#: src/gui/html/js/events.js:281
msgid "metadata edits"
msgstr ""
@@ -584,32 +584,18 @@ msgid ""
"can be accessed through the main menu."
msgstr ""
#: src/gui/query_handler.cpp:133
#: src/gui/query/get_game_data_query.h:45
msgid "Parsing, merging and evaluating metadata..."
msgstr ""
#: src/gui/query_handler.cpp:191 src/gui/query_handler.cpp:194
msgid "Failed to change game. Details: %1%"
msgstr ""
#: src/gui/query_handler.cpp:208 src/gui/query_handler.cpp:211
#: src/gui/query_handler.cpp:289 src/gui/query_handler.cpp:292
#: src/gui/query_handler.cpp:320 src/gui/query_handler.cpp:323
msgid "Failed to copy plugin metadata. Details: %1%"
msgstr ""
#: src/gui/query_handler.cpp:229 src/gui/query_handler.cpp:239
msgid "Failed to apply plugin metadata. Details: %1%"
msgstr ""
#: src/gui/query_handler.cpp:592
#: src/gui/query/get_game_data_query.h:80
msgid ""
"An error occurred while parsing the masterlist: %1%. This probably happened "
"because an update to LOOT changed its metadata syntax support. Try updating "
"your masterlist to resolve the error."
msgstr ""
#: src/gui/query_handler.cpp:607
#: src/gui/query/get_game_data_query.h:94
msgid ""
"An error occurred while parsing the userlist: %1%. This probably happened "
"because an update to LOOT changed its metadata syntax support. Your user "
@@ -625,36 +611,24 @@ msgid ""
"[LOOT's website](https://loot.github.io/)."
msgstr ""
#: src/gui/query_handler.cpp:712 src/gui/query_handler.cpp:715
msgid "Failed to get game data. Details: %1%"
msgstr ""
#: src/gui/query_handler.cpp:797 src/gui/query_handler.cpp:800
msgid "Failed to update the masterlist. Details: %1%"
msgstr ""
#: src/gui/query_handler.cpp:839
msgid "Loading plugin contents..."
msgstr ""
#: src/gui/query_handler.cpp:843
msgid "Sorting load order..."
msgstr ""
#: src/gui/query_handler.cpp:900
msgid "Failed to sort plugins. Details: %1%"
msgstr ""
#: src/gui/query_handler.cpp:931
#: src/gui/query/metadata_query.h:94
msgid ""
"A global message contains a condition that could not be evaluated. Details: "
"%1%"
msgstr ""
#: src/gui/query_handler.cpp:963 src/backend/plugin/plugin_sorter.cpp:217
#: src/gui/query/metadata_query.h:120 src/backend/plugin/plugin_sorter.cpp:217
msgid "\"%1%\" contains a condition that could not be evaluated. Details: %2%"
msgstr ""
#: src/gui/query/sort_plugins_query.h:46
msgid "Loading plugin contents..."
msgstr ""
#: src/gui/query/sort_plugins_query.h:66
msgid "Sorting load order..."
msgstr ""
#: src/backend/app/loot_paths.cpp:85
msgid "Failed to get %LOCALAPPDATA% path."
msgstr ""
@@ -831,7 +805,7 @@ msgstr ""
msgid "This plugin is incompatible with \"%1%\", but both are present."
msgstr ""
#: src/backend/plugin/plugin_sorter.cpp:81
#: src/backend/plugin/plugin_sorter.cpp:82
msgid ""
"Cyclic interaction detected between plugins \"%1%\" and \"%2%\". Back cycle: "
"%3%"
+3
View File
@@ -1,3 +1,6 @@
# Assumes that 'C:\projects' exists and that 7-zip is installed and 7z.exe is
# available on the PATH.
Add-Type -AssemblyName System.IO.Compression.FileSystem
$boostUrl = 'https://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.7z?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.61.0%2F&ts=1468862599&use_mirror=ncu'
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# This script prepares a fresh install of Ubuntu Server 12.04 so that the steps
# in .travis.yml can then be run.
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update
sudo apt-get install -y python-software-properties git build-essential libcurl4-openssl-dev
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280
sudo apt-add-repository -y 'deb https://deb.nodesource.com/node_4.x precise main'
sudo apt-get update
sudo apt-get install -y nodejs
+3 -1
View File
@@ -1,4 +1,6 @@
/* Convert .po files to .mo files. */
/* eslint-disable no-unused-vars */
'use strict';
const childProcess = require('child_process');
const fs = require('fs');
@@ -12,7 +14,7 @@ function getMsgfmtPath() {
path.join('/', 'usr', 'bin', 'msgfmt'),
];
for (let i = 0; i < paths.length; ++i) {
for (let i = 0; i < paths.length; i += 1) {
if (helpers.fileExists(paths[i])) {
return paths[i];
}
+2
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env node
// Build the UI's index.html file. Takes one argument, which is the path to the
// repository's root.
/* eslint-disable no-unused-vars */
'use strict';
const path = require('path');
const fs = require('fs');
+16 -5
View File
@@ -31,7 +31,16 @@
#include "loot/error.h"
#include "backend/app/loot_paths.h"
namespace fs = boost::filesystem;
namespace loot {
std::string ResolvePath(const std::string& path) {
if (path.empty() || !fs::is_symlink(path))
return path;
return fs::read_symlink(path).string();
}
LOOT_API bool IsCompatible(const unsigned int versionMajor, const unsigned int versionMinor, const unsigned int versionPatch) {
if (versionMajor > 0)
return versionMajor == loot::LootVersion::major;
@@ -48,12 +57,14 @@ LOOT_API std::shared_ptr<DatabaseInterface> CreateDatabase(const GameType game,
boost::log::core::get()->set_logging_enabled(false);
// Check for valid paths.
if (!gamePath.empty() && !boost::filesystem::is_directory(gamePath))
throw loot::Error(Error::Code::invalid_args, "Given game path \"" + std::string(gamePath) + "\" is not a valid directory.");
const std::string resolvedGamePath = ResolvePath(gamePath);
if (!gamePath.empty() && !fs::is_directory(resolvedGamePath))
throw Error(Error::Code::invalid_args, "Given game path \"" + gamePath + "\" does not resolve to a valid directory.");
if (!gameLocalPath.empty() && !boost::filesystem::is_directory(gameLocalPath))
throw loot::Error(Error::Code::invalid_args, "Given local data path \"" + std::string(gameLocalPath) + "\" is not a valid directory.");
const std::string resolvedGameLocalPath = ResolvePath(gameLocalPath);
if (!gameLocalPath.empty() && !fs::is_directory(resolvedGameLocalPath))
throw Error(Error::Code::invalid_args, "Given local data path \"" + gameLocalPath + "\" does not resolve to a valid directory.");
return std::make_shared<ApiDatabase>(game, gamePath, gameLocalPath);
return std::make_shared<ApiDatabase>(game, resolvedGamePath, resolvedGameLocalPath);
}
}
+1 -4
View File
@@ -146,10 +146,7 @@ void GitHelper::Clone(const boost::filesystem::path& path, const std::string& ur
// Clone the remote repository.
BOOST_LOG_TRIVIAL(info) << "Repository doesn't exist, cloning the remote repository.";
fs::path tempPath = fs::temp_directory_path() / fs::unique_path();
// Create the temporary parent folder in case it doesn't already exist.
fs::create_directories(tempPath.parent_path());
fs::path tempPath = path.parent_path() / fs::unique_path();
//Delete temporary folder in case it already exists.
fs::remove_all(tempPath);
+2 -2
View File
@@ -87,7 +87,7 @@
/* Also disable deletion of the game's row in the settings dialog. */
const table = document.getElementById('gameTable');
for (let i = 0; i < table.tBodies[0].rows.length; ++i) {
for (let i = 0; i < table.tBodies[0].rows.length; i += 1) {
const folderElements = table.tBodies[0].rows[i].getElementsByClassName('folder');
if (folderElements.length === 1) {
table.setReadOnly(table.tBodies[0].rows[i],
@@ -99,7 +99,7 @@
static updateEnabledGames(installedGames) {
const gameMenuItems = document.getElementById('gameMenu').children;
for (let i = 0; i < gameMenuItems.length; ++i) {
for (let i = 0; i < gameMenuItems.length; i += 1) {
DOM.enable(gameMenuItems[i],
installedGames.indexOf(gameMenuItems[i].getAttribute('value')) !== -1);
}
+9 -5
View File
@@ -1,3 +1,5 @@
/* eslint-disable no-unused-vars */
'use strict';
function onSidebarFilterToggle(evt) {
loot.filters[evt.target.id] = evt.target.checked;
@@ -313,13 +315,15 @@ function onCloseSettingsDialog(evt) {
loot.query('closeSettings', settings).then(JSON.parse).then((installedGames) => {
loot.installedGames = installedGames;
loot.DOM.updateEnabledGames(installedGames);
}).catch(loot.handlePromiseError).then(() => {
}).catch(loot.handlePromiseError)
.then(() => {
loot.settings = settings;
loot.DOM.updateSettingsDialog(loot.settings);
loot.DOM.setGameMenuItems(loot.settings.games);
loot.DOM.updateEnabledGames(loot.installedGames);
loot.DOM.updateSelectedGame(loot.game.folder);
}).catch(loot.handlePromiseError);
})
.catch(loot.handlePromiseError);
}
function onEditorOpen(evt) {
/* Set the editor data. */
@@ -334,7 +338,7 @@ function onEditorOpen(evt) {
/* Set up drag 'n' drop event handlers. */
const elements = document.getElementById('cardsNav').getElementsByTagName('loot-plugin-item');
for (let i = 0; i < elements.length; ++i) {
for (let i = 0; i < elements.length; i += 1) {
elements[i].draggable = true;
elements[i].addEventListener('dragstart', elements[i].onDragStart);
}
@@ -380,7 +384,7 @@ function onEditorClose(evt) {
/* Remove drag 'n' drop event handlers. */
const elements = document.getElementById('cardsNav').getElementsByTagName('loot-plugin-item');
for (let i = 0; i < elements.length; ++i) {
for (let i = 0; i < elements.length; i += 1) {
elements[i].removeAttribute('draggable');
elements[i].removeEventListener('dragstart', elements[i].onDragStart);
}
@@ -449,7 +453,7 @@ function onSearchEnd(evt) {
function onFolderChange(evt) {
loot.DOM.updateSelectedGame(evt.detail.folder);
/* Enable/disable the redate plugins option. */
let gameSettings = undefined;
let gameSettings;
if (loot.settings && loot.settings.games) {
gameSettings = loot.settings.games.find(game => game.folder === evt.detail.folder);
}
+1 -1
View File
@@ -126,7 +126,7 @@
document.getElementById('pluginCardList').items = filteredPlugins;
const pluginCards = document.getElementById('pluginCardList').children;
for (let i = 0; i < pluginCards.length; ++i) {
for (let i = 0; i < pluginCards.length; i += 1) {
if (pluginCards[i].data) {
pluginCards[i].updateContent(true);
}
+18 -18
View File
@@ -53,9 +53,9 @@
oldTotal = this._globalMessages.length;
this._globalMessages.forEach((message) => {
if (message.type === 'warn') {
++oldWarns;
oldWarns += 1;
} else if (message.type === 'error') {
++oldErrs;
oldErrs += 1;
}
});
}
@@ -65,9 +65,9 @@
globalMessages.forEach((message) => {
if (message.type === 'warn') {
++newWarns;
newWarns += 1;
} else if (message.type === 'error') {
++newErrs;
newErrs += 1;
}
});
}
@@ -134,27 +134,27 @@
totalMessageNo = this.globalMessages.length;
this.globalMessages.forEach((message) => {
if (message.type === 'warn') {
++warnMessageNo;
warnMessageNo += 1;
} else if (message.type === 'error') {
++errorMessageNo;
errorMessageNo += 1;
}
});
}
plugins.forEach((plugin) => {
if (plugin.isActive) {
++activePluginNo;
activePluginNo += 1;
}
if (plugin.isDirty) {
++dirtyPluginNo;
dirtyPluginNo += 1;
}
if (plugin.messages) {
totalMessageNo += plugin.messages.length;
plugin.messages.forEach((message) => {
if (message.type === 'warn') {
++warnMessageNo;
warnMessageNo += 1;
} else if (message.type === 'error') {
++errorMessageNo;
errorMessageNo += 1;
}
});
}
@@ -183,18 +183,18 @@
let dirtyChange = 0;
if (plugin.isActive) {
++activeChange;
activeChange += 1;
}
if (plugin.isDirty) {
++dirtyChange;
dirtyChange += 1;
}
if (plugin.messages) {
totalChange += plugin.messages.length;
plugin.messages.forEach((message) => {
if (message.type === 'warn') {
++warnChange;
warnChange += 1;
} else if (message.type === 'error') {
++errorChange;
errorChange += 1;
}
});
}
@@ -222,18 +222,18 @@
let dirtyChange = 0;
if (this._plugins[index].isActive) {
--activeChange;
activeChange -= 1;
}
if (this._plugins[index].isDirty) {
--dirtyChange;
dirtyChange -= 1;
}
if (this._plugins[index].messages) {
totalChange -= this._plugins[index].messages.length;
this._plugins[index].messages.forEach((message) => {
if (message.type === 'warn') {
--warnChange;
warnChange -= 1;
} else if (message.type === 'error') {
--errorChange;
errorChange -= 1;
}
});
}
+12 -10
View File
@@ -102,7 +102,7 @@
const tagsRemoved = [];
if (this._tags) {
for (let i = 0; i < this._tags.length; ++i) {
for (let i = 0; i < this._tags.length; i += 1) {
if (this._tags[i].name[0] === '-') {
tagsRemoved.push(this._tags[i].name.substr(1));
} else {
@@ -112,12 +112,12 @@
}
/* Now make sure that the same tag doesn't appear in both arrays.
Prefer the removed list. */
for (let i = 0; i < tagsAdded.length; ++i) {
for (let j = 0; j < tagsRemoved.length; ++j) {
for (let i = 0; i < tagsAdded.length; i += 1) {
for (let j = 0; j < tagsRemoved.length; j += 1) {
if (tagsRemoved[j].toLowerCase() === tagsAdded[i].toLowerCase()) {
/* Remove tag from the tagsAdded array. */
tagsAdded.splice(i, 1);
--i;
i -= 1;
}
}
}
@@ -149,7 +149,7 @@
return true;
}
for (let i = 0; i < this.messages.length; ++i) {
for (let i = 0; i < this.messages.length; i += 1) {
if (this.messages[i].text.toLowerCase().indexOf(needle) !== -1) {
return true;
}
@@ -208,7 +208,9 @@
}
static tagFromRowData(rowData) {
if (rowData.condition === undefined || rowData.name === undefined || rowData.type === undefined) {
if (rowData.condition === undefined
|| rowData.name === undefined
|| rowData.type === undefined) {
throw new TypeError('Row data members are undefined');
}
const tag = {
@@ -284,9 +286,9 @@
this._messages.forEach((message) => {
if (message.type === 'warn') {
++oldWarns;
oldWarns += 1;
} else if (message.type === 'error') {
++oldErrs;
oldErrs += 1;
}
});
@@ -294,9 +296,9 @@
messages.forEach((message) => {
if (message.type === 'warn') {
++newWarns;
newWarns += 1;
} else if (message.type === 'error') {
++newErrs;
newErrs += 1;
}
});
+1 -2
View File
@@ -71,7 +71,6 @@
if (this.jed === undefined) {
return text;
}
const func = this.jed.translate(text);
return func.fetch.apply(func, substitutions);
return this.jed.translate(text).fetch(...substitutions);
}
}));
+18 -1
View File
@@ -35,17 +35,29 @@ namespace loot {
namespace test {
class CreateDatabaseTest : public CommonGameTestFixture {
protected:
CreateDatabaseTest() : db_(nullptr) {}
CreateDatabaseTest() :
db_(nullptr),
gamePathSymlink(dataPath.parent_path().string() + "symlink"),
localPathSymlink(localPath.string() + "symlink") {}
void SetUp() {
CommonGameTestFixture::SetUp();
boost::filesystem::create_directory_symlink(dataPath.parent_path(), gamePathSymlink);
boost::filesystem::create_directory_symlink(localPath, localPathSymlink);
}
void TearDown() {
CommonGameTestFixture::TearDown();
boost::filesystem::remove(gamePathSymlink);
boost::filesystem::remove(localPathSymlink);
}
std::shared_ptr<DatabaseInterface> db_;
const boost::filesystem::path gamePathSymlink;
const boost::filesystem::path localPathSymlink;
};
// Pass an empty first argument, as it's a prefix for the test instantation,
@@ -86,6 +98,11 @@ TEST_P(CreateDatabaseTest, shouldReturnOkIfPassedAnEmptyLocalPathString) {
EXPECT_NE(nullptr, db_);
}
#endif
TEST_P(CreateDatabaseTest, shouldReturnOkIfPassedGameAndLocalPathSymlinks) {
EXPECT_NO_THROW(db_ = CreateDatabase(GetParam(), gamePathSymlink.string(), localPathSymlink.string()));
EXPECT_NE(nullptr, db_);
}
}
}

Some files were not shown because too many files have changed in this diff Show More