mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
Use custom "argc" and "argv" exposing. Fixes #6
This commit is contained in:
@@ -18,6 +18,9 @@ using s128 = __int128_t;
|
|||||||
#include "lang/result.hpp"
|
#include "lang/result.hpp"
|
||||||
#include "lang/results.hpp"
|
#include "lang/results.hpp"
|
||||||
|
|
||||||
|
extern int mainArgc;
|
||||||
|
extern char **mainArgv;
|
||||||
|
|
||||||
#if defined(__EMX__) || defined (WIN32)
|
#if defined(__EMX__) || defined (WIN32)
|
||||||
#define MAGIC_PATH_SEPARATOR ";"
|
#define MAGIC_PATH_SEPARATOR ";"
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -148,10 +148,10 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LoaderScript::processFile(std::string_view scriptPath) {
|
bool LoaderScript::processFile(std::string_view scriptPath) {
|
||||||
Py_SetProgramName(Py_DecodeLocale(__argv[0], nullptr));
|
Py_SetProgramName(Py_DecodeLocale(mainArgv[0], nullptr));
|
||||||
|
|
||||||
if (std::filesystem::exists(std::filesystem::path(__argv[0]).parent_path().string() + "/lib/python3.8"))
|
if (std::filesystem::exists(std::filesystem::path(mainArgv[0]).parent_path().string() + "/lib/python3.8"))
|
||||||
Py_SetPythonHome(Py_DecodeLocale(std::filesystem::path(__argv[0]).parent_path().string().c_str(), nullptr));
|
Py_SetPythonHome(Py_DecodeLocale(std::filesystem::path(mainArgv[0]).parent_path().string().c_str(), nullptr));
|
||||||
|
|
||||||
PyImport_AppendInittab("_imhex", []() -> PyObject* {
|
PyImport_AppendInittab("_imhex", []() -> PyObject* {
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,13 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int main() {
|
int mainArgc;
|
||||||
|
char **mainArgv;
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
mainArgc = argc;
|
||||||
|
mainArgv = argv;
|
||||||
|
|
||||||
hex::Window window;
|
hex::Window window;
|
||||||
|
|
||||||
// Shared Data
|
// Shared Data
|
||||||
|
|||||||
Reference in New Issue
Block a user