build: Bundle files from the ImHex-Patterns repo with the installation
This commit is contained in:
parent
bdb2ac3a0b
commit
1487f760b0
@ -35,3 +35,6 @@ add_subdirectory(tests EXCLUDE_FROM_ALL)
|
||||
|
||||
# Configure packaging
|
||||
createPackage()
|
||||
|
||||
# Download and install all current files from the ImHex-Patterns repo
|
||||
downloadImHexPatternsFiles()
|
@ -1,3 +1,5 @@
|
||||
include(FetchContent)
|
||||
|
||||
macro(addVersionDefines)
|
||||
if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
|
||||
# Get the current working branch
|
||||
@ -279,3 +281,20 @@ macro(detectBadClone)
|
||||
endif()
|
||||
endforeach ()
|
||||
endmacro()
|
||||
|
||||
|
||||
function(downloadImHexPatternsFiles)
|
||||
FetchContent_Declare(
|
||||
imhex_patterns
|
||||
GIT_REPOSITORY https://github.com/WerWolv/ImHex-Patterns.git
|
||||
GIT_TAG master
|
||||
)
|
||||
|
||||
FetchContent_Populate(imhex_patterns)
|
||||
|
||||
set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns yara magic)
|
||||
foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL})
|
||||
install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION "./")
|
||||
endforeach()
|
||||
|
||||
endfunction()
|
@ -59,7 +59,7 @@ namespace hex {
|
||||
CoTaskMemFree(wAppDataPath);
|
||||
}
|
||||
|
||||
std::vector<fs::path> paths = { parentDir, appDataDir / "imhex" };
|
||||
std::vector<fs::path> paths = { appDataDir / "imhex", parentDir };
|
||||
|
||||
switch (path) {
|
||||
case ImHexPath::Patterns:
|
||||
@ -128,7 +128,7 @@ namespace hex {
|
||||
// Get path to special directories
|
||||
const fs::path applicationSupportDir(getMacApplicationSupportDirectoryPath());
|
||||
|
||||
std::vector<fs::path> paths = { exePath, applicationSupportDir };
|
||||
std::vector<fs::path> paths = { applicationSupportDir, exePath };
|
||||
|
||||
switch (path) {
|
||||
case ImHexPath::Patterns:
|
||||
@ -179,9 +179,6 @@ namespace hex {
|
||||
for (auto &dir : dataDirs)
|
||||
dir = dir / "imhex";
|
||||
|
||||
if (!exePath.empty())
|
||||
dataDirs.emplace(dataDirs.begin(), fs::path(exePath.data()).parent_path());
|
||||
|
||||
switch (path) {
|
||||
case ImHexPath::Patterns:
|
||||
addUserDirs(dataDirs);
|
||||
@ -226,6 +223,9 @@ namespace hex {
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
if (!exePath.empty())
|
||||
dataDirs.emplace(dataDirs.begin(), fs::path(exePath.data()).parent_path());
|
||||
#endif
|
||||
|
||||
if (!listNonExisting) {
|
||||
|
Loading…
Reference in New Issue
Block a user