Compare commits
2 Commits
7977fb976b
...
a836dd31e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
a836dd31e2
|
|||
|
94e5450a74
|
@@ -15,8 +15,6 @@ int main(int arc, char** args) {
|
||||
|
||||
bool everythingIsOK = true;
|
||||
|
||||
AssetManager::setExePath(args[0]);
|
||||
|
||||
// CHECK PIECES FILES
|
||||
|
||||
PiecesFiles pf;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user