1
0
mirror of synced 2025-01-18 09:04:52 +01:00

Use custom "argc" and "argv" exposing. Fixes #6

This commit is contained in:
WerWolv 2020-12-01 18:19:49 +01:00
parent 76d56c9ed4
commit 6aed140ecf
3 changed files with 13 additions and 4 deletions

View File

@ -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

View File

@ -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* {

View File

@ -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