sys: Allow resources to be placed in appdata on windows
This commit is contained in:
parent
222e9f6645
commit
d3fb00d441
@ -44,7 +44,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.welcome.learn.latest.desc", "Read ImHex's current changelog" },
|
{ "hex.welcome.learn.latest.desc", "Read ImHex's current changelog" },
|
||||||
{ "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
{ "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" },
|
||||||
{ "hex.welcome.learn.pattern.title", "Pattern Language Documentation" },
|
{ "hex.welcome.learn.pattern.title", "Pattern Language Documentation" },
|
||||||
{ "hex.welcome.learn.pattern.desc", "Learn how to write ImHex pattern_language with our extensive documentation" },
|
{ "hex.welcome.learn.pattern.desc", "Learn how to write ImHex patterns with our extensive documentation" },
|
||||||
{ "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" },
|
{ "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" },
|
||||||
{ "hex.welcome.learn.plugins.title", "Plugins API" },
|
{ "hex.welcome.learn.plugins.title", "Plugins API" },
|
||||||
{ "hex.welcome.learn.plugins.desc", "Extend ImHex with additional features using plugins" },
|
{ "hex.welcome.learn.plugins.desc", "Extend ImHex with additional features using plugins" },
|
||||||
|
@ -32,27 +32,56 @@ namespace hex {
|
|||||||
CoTaskMemFree(wAppDataPath);
|
CoTaskMemFree(wAppDataPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::filesystem::path> paths = { parentDir, appDataDir / "imhex" };
|
||||||
|
std::vector<std::string> results;
|
||||||
|
|
||||||
switch (path) {
|
switch (path) {
|
||||||
case ImHexPath::Patterns:
|
case ImHexPath::Patterns:
|
||||||
return { (parentDir / "pattern_language").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "patterns").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::PatternsInclude:
|
case ImHexPath::PatternsInclude:
|
||||||
return { (parentDir / "includes").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "includes").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::Magic:
|
case ImHexPath::Magic:
|
||||||
return { (parentDir / "magic").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "magic").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::Python:
|
case ImHexPath::Python:
|
||||||
return { parentDir.string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "python").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::Plugins:
|
case ImHexPath::Plugins:
|
||||||
return { (parentDir / "plugins").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "plugins").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::Yara:
|
case ImHexPath::Yara:
|
||||||
return { (parentDir / "yara").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "yara").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::Config:
|
case ImHexPath::Config:
|
||||||
return { (appDataDir / "imhex" / "config").string() };
|
return { (appDataDir / "imhex" / "config").string() };
|
||||||
case ImHexPath::Resources:
|
case ImHexPath::Resources:
|
||||||
return { (parentDir / "resources").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "resources").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case ImHexPath::Constants:
|
case ImHexPath::Constants:
|
||||||
return { (parentDir / "constants").string() };
|
std::transform(paths.begin(), paths.end(), std::back_inserter(results), [](auto &path){
|
||||||
|
return (path / "constants").string();
|
||||||
|
});
|
||||||
|
break;
|
||||||
default: __builtin_unreachable();
|
default: __builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
#elif defined(OS_MACOS)
|
#elif defined(OS_MACOS)
|
||||||
return { getPathForMac(path) };
|
return { getPathForMac(path) };
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user