MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / getDataPaths

Function getDataPaths

src/gui2/imhex_overrides/default_paths.cpp:20–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 const char* ApplicationName = "fluxengine";
19
20 std::vector<std::fs::path> getDataPaths(bool includeSystemFolders)
21 {
22 std::vector<std::fs::path> paths;
23
24#if defined(OS_WINDOWS)
25
26 // In the portable Windows version, we just use the executable directory
27 // Prevent the use of the AppData folder here
28 if (!ImHexApi::System::isPortableVersion())
29 {
30 PWSTR wAppDataPath = nullptr;
31 if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppData,
32 KF_FLAG_CREATE,
33 nullptr,
34 &wAppDataPath)))
35 {
36 paths.emplace_back(wAppDataPath);
37 CoTaskMemFree(wAppDataPath);
38 }
39 }
40
41#elif defined(OS_MACOS)
42
43 paths.push_back(wolv::io::fs::getApplicationSupportDirectoryPath() /
44 ApplicationName);
45
46#elif defined(OS_LINUX) || defined(OS_WEB)
47
48 paths.push_back(xdg::DataHomeDir());
49
50#endif
51
52#if defined(OS_MACOS)
53
54 if (includeSystemFolders)
55 {
56 if (auto executablePath = wolv::io::fs::getExecutablePath();
57 executablePath.has_value())
58 {
59 paths.push_back(executablePath->parent_path());
60 }
61 }
62
63#else
64
65 for (auto& path : paths)
66 path = path / ApplicationName;
67
68 if (ImHexApi::System::isPortableVersion() || includeSystemFolders)
69 {
70 if (auto executablePath = wolv::io::fs::getExecutablePath();
71 executablePath.has_value())
72 paths.push_back(executablePath->parent_path());
73 }
74
75#endif
76
77 // Add additional data directories to the path

Callers 5

fluxengine.ccFile · 0.85
getConfigPathsFunction · 0.85
getPluginPathsFunction · 0.85
allMethod · 0.85
writeMethod · 0.85

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected