Use custom "argc" and "argv" exposing. Fixes #6
This commit is contained in:
parent
76d56c9ed4
commit
6aed140ecf
@ -18,6 +18,9 @@ using s128 = __int128_t;
|
||||
#include "lang/result.hpp"
|
||||
#include "lang/results.hpp"
|
||||
|
||||
extern int mainArgc;
|
||||
extern char **mainArgv;
|
||||
|
||||
#if defined(__EMX__) || defined (WIN32)
|
||||
#define MAGIC_PATH_SEPARATOR ";"
|
||||
#else
|
||||
|
@ -148,10 +148,10 @@ namespace hex {
|
||||
}
|
||||
|
||||
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"))
|
||||
Py_SetPythonHome(Py_DecodeLocale(std::filesystem::path(__argv[0]).parent_path().string().c_str(), nullptr));
|
||||
if (std::filesystem::exists(std::filesystem::path(mainArgv[0]).parent_path().string() + "/lib/python3.8"))
|
||||
Py_SetPythonHome(Py_DecodeLocale(std::filesystem::path(mainArgv[0]).parent_path().string().c_str(), nullptr));
|
||||
|
||||
PyImport_AppendInittab("_imhex", []() -> PyObject* {
|
||||
|
||||
|
@ -18,7 +18,13 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
int main() {
|
||||
int mainArgc;
|
||||
char **mainArgv;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mainArgc = argc;
|
||||
mainArgv = argv;
|
||||
|
||||
hex::Window window;
|
||||
|
||||
// Shared Data
|
||||
|
Loading…
x
Reference in New Issue
Block a user