diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bc35b0ca..13c1eb249 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake") # Setup project -loadVersion(IMHEX_VERSION) -string(REPLACE "-WIP" "" IMHEX_VERSION_PLAIN ${IMHEX_VERSION}) +loadVersion(IMHEX_VERSION IMHEX_VERSION_PLAIN) setVariableInParent(IMHEX_VERSION ${IMHEX_VERSION}) configureCMake() diff --git a/VERSION b/VERSION index df4a52f4b..32380bd3b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.35.0-WIP \ No newline at end of file +1.35.0.WIP \ No newline at end of file diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 1a989c9f5..9b0551a6e 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -397,12 +397,14 @@ macro(setDefaultBuiltTypeIfUnset) endif() endmacro() -function(loadVersion version) +function(loadVersion version plain_version) set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/VERSION") set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${VERSION_FILE}) file(READ "${VERSION_FILE}" read_version) string(STRIP ${read_version} read_version) + string(REPLACE ".WIP" "" read_version_plain ${read_version}) set(${version} ${read_version} PARENT_SCOPE) + set(${plain_version} ${read_version_plain} PARENT_SCOPE) endfunction() function(detectBadClone) diff --git a/lib/libimhex/include/hex/api/imhex_api.hpp b/lib/libimhex/include/hex/api/imhex_api.hpp index 6b89fd799..454659ea3 100644 --- a/lib/libimhex/include/hex/api/imhex_api.hpp +++ b/lib/libimhex/include/hex/api/imhex_api.hpp @@ -632,6 +632,12 @@ namespace hex { */ bool isDebugBuild(); + /** + * @brief Checks if this version of ImHex is a nightly build + * @return True if this version is a nightly, false if it's a release + */ + bool isNightlyBuild(); + enum class UpdateType { Stable, Nightly diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index d12e82b89..ce4636e29 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -805,6 +805,10 @@ namespace hex { #endif } + bool isNightly() { + return getImHexVersion(false).ends_with("WIP"); + } + bool updateImHex(UpdateType updateType) { // Get the path of the updater executable std::fs::path executablePath;