From d981b29438e616af2ce3a67b275a047e128c0f1b Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 5 Feb 2017 15:20:23 +0000 Subject: [PATCH] Give the API its own resource file --- CMakeLists.txt | 6 +++--- scripts/set_version_number.js | 13 ++++++++----- src/api/resource.rc | 25 +++++++++++++++++++++++++ src/gui/query_handler.cpp | 1 - src/{ => gui}/resource.rc | 0 5 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 src/api/resource.rc rename src/{ => gui}/resource.rc (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a69c4fa9..a64aa0f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,7 +187,8 @@ set (LOOT_API_SRC "${CMAKE_BINARY_DIR}/generated/loot_version.cpp" "${CMAKE_SOURCE_DIR}/src/api/helpers/crc.cpp" "${CMAKE_SOURCE_DIR}/src/api/helpers/git_helper.cpp" "${CMAKE_SOURCE_DIR}/src/api/helpers/language.cpp" - "${CMAKE_SOURCE_DIR}/src/api/helpers/version.cpp") + "${CMAKE_SOURCE_DIR}/src/api/helpers/version.cpp" + "${CMAKE_SOURCE_DIR}/src/api/resource.rc") set (LOOT_API_HEADERS "${CMAKE_SOURCE_DIR}/include/loot/api.h" "${CMAKE_SOURCE_DIR}/include/loot/api_decorator.h" @@ -251,7 +252,7 @@ set (LOOT_GUI_SRC "${CMAKE_SOURCE_DIR}/src/gui/main.cpp" "${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.cpp" "${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.cpp" "${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.cpp" - "${CMAKE_SOURCE_DIR}/src/resource.rc") + "${CMAKE_SOURCE_DIR}/src/gui/resource.rc") set (LOOT_GUI_HEADERS "${CMAKE_SOURCE_DIR}/src/gui/editor_message.h" "${CMAKE_SOURCE_DIR}/src/gui/helpers.h" @@ -385,7 +386,6 @@ include_directories ("${CMAKE_SOURCE_DIR}/src" # Settings when compiling for Windows. IF (CMAKE_SYSTEM_NAME MATCHES "Windows") add_definitions (-DUNICODE -D_UNICODE -DLIBLO_STATIC) - set (LOOT_API_SRC ${LOOT_API_SRC} "${CMAKE_SOURCE_DIR}/src/resource.rc") ENDIF () IF (CMAKE_COMPILER_IS_GNUCXX) diff --git a/scripts/set_version_number.js b/scripts/set_version_number.js index 8c8a6fe9..ac0a8783 100644 --- a/scripts/set_version_number.js +++ b/scripts/set_version_number.js @@ -48,21 +48,24 @@ function updateCppFile(version) { }); } -function updateResourceFile(version) { - const file = path.join('src', 'resource.rc'); +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: [file], + paths: files, silent: true, }); replace({ regex: /Version", "\d+\.\d+\.\d+"/g, replacement: `Version", "${version}"`, - paths: [file], + paths: files, silent: true, }); } @@ -83,7 +86,7 @@ function main() { updatePreCommitHookScript(newVersion); updateInstallerScript(newVersion); updateCppFile(newVersion); - updateResourceFile(newVersion); + updateResourceFiles(newVersion); } main(); diff --git a/src/api/resource.rc b/src/api/resource.rc new file mode 100644 index 00000000..e7b77da5 --- /dev/null +++ b/src/api/resource.rc @@ -0,0 +1,25 @@ +#ifdef _WIN32 +#include + +1 VERSIONINFO +FILEVERSION 0, 10, 3, 0 +PRODUCTVERSION 0, 10, 3, 0 +FILEOS VOS__WINDOWS32 +FILETYPE VFT_APP +BEGIN +BLOCK "StringFileInfo" +BEGIN +BLOCK "040904b0" +BEGIN +VALUE "FileVersion", "0.10.3" +VALUE "LegalCopyright", "Copyright (C) 2013-2016 WrinklyNinja" +VALUE "ProductVersion", "0.10.3" +END +END +BLOCK "VarFileInfo" +BEGIN +VALUE "Translation", 0x409, 1200 +END +END + +#endif diff --git a/src/gui/query_handler.cpp b/src/gui/query_handler.cpp index 6246d120..2fd8f446 100644 --- a/src/gui/query_handler.cpp +++ b/src/gui/query_handler.cpp @@ -68,7 +68,6 @@ #include "gui/query/save_filter_state_query.h" #include "gui/query/sort_plugins_query.h" #include "gui/query/update_masterlist_query.h" -#include "gui/resource.h" #include "gui/yaml_simple_message_helpers.h" diff --git a/src/resource.rc b/src/gui/resource.rc similarity index 100% rename from src/resource.rc rename to src/gui/resource.rc