2 Commits

Author SHA1 Message Date
a836dd31e2 fix exec path
All checks were successful
Linux arm64 / Build (push) Successful in 2m13s
2025-07-29 21:36:18 +02:00
94e5450a74 fix icon path 2025-07-29 21:36:01 +02:00
4 changed files with 21 additions and 13 deletions

View File

@@ -15,8 +15,6 @@ int main(int arc, char** args) {
bool everythingIsOK = true;
AssetManager::setExePath(args[0]);
// CHECK PIECES FILES
PiecesFiles pf;

View File

@@ -1,18 +1,33 @@
#include "AssetManager.h"
#ifdef _WIN32
#include <windows.h> //GetModuleFileNameW
#else
#include <limits.h>
#include <unistd.h> //readlink
#endif
namespace fs = std::filesystem;
static fs::path EXE_DIRECTORY;
void AssetManager::setExePath(const std::string& arg0) {
EXE_DIRECTORY = fs::path(arg0).parent_path();
static fs::path getExeDirectory(){
#ifdef _WIN32
wchar_t path[MAX_PATH] = { 0 };
GetModuleFileNameW(NULL, path, MAX_PATH);
return path;
#else
char result[PATH_MAX];
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
return std::string(result, (count > 0) ? count : 0);
#endif
}
static fs::path getEnv(const std::string& var) {
char* env = std::getenv(var.c_str());
return env ? env :
#ifdef JMINOS_IGNORE_WORKDIR
EXE_DIRECTORY.parent_path();
getExeDirectory().parent_path().parent_path();
#else
"";
#endif

View File

@@ -15,9 +15,4 @@ class AssetManager {
* @brief Used to save things
*/
static std::filesystem::path getConfigPath(const std::string& resource);
/**
* @brief Set the current path of the executable
*/
static void setExePath(const std::string& arg0);
};

View File

@@ -25,7 +25,7 @@ xpack("jminos")
set_formats("zip", "nsis")
add_targets("graph")
add_installfiles("(data/**.png)")
set_iconfile("flatpak/org.zulianc.jminos.ico")
set_iconfile("../flatpak/org.zulianc.jminos.ico")
on_load(function (package)
package:set("basename", package:name() .. "-v" .. package:version() .. "-" .. package:arch())
end)