diff --git a/Server/Components/Pawn/main.cpp b/Server/Components/Pawn/main.cpp index 3955087bf..be6463d6d 100644 --- a/Server/Components/Pawn/main.cpp +++ b/Server/Components/Pawn/main.cpp @@ -122,6 +122,16 @@ class PawnComponent final : public IPawnComponent, public CoreEventHandler, publ { ghc::filesystem::create_directory(scriptfilesPath); } + +#if defined(GHC_USE_WCHAR_T) + std::wstring wstr_path = scriptfilesPath.wstring(); + std::wstring::size_type size = wstr_path.size(); + + wchar_t* path = new wchar_t[size + 1]; + memcpy((void*)path, (void*)wstr_path.c_str(), (size + 1) * sizeof(wchar_t)); + + _wputenv_s(L"AMXFILE", path); +#else std::string amxFileEnvVar = scriptfilesPath.string(); amxFileEnvVar.insert(0, "AMXFILE="); @@ -132,6 +142,7 @@ class PawnComponent final : public IPawnComponent, public CoreEventHandler, publ memcpy(amxFileEnvVarCString, amxFileEnvVar.c_str(), size + 1); putenv(amxFileEnvVarCString); +#endif } void onInit(IComponentList* components) override