diff --git a/src/Editors/LevelEditor/Plugins/PluginPython.cpp b/src/Editors/LevelEditor/Plugins/PluginPython.cpp index c5ed4ea883..1e2daca154 100644 --- a/src/Editors/LevelEditor/Plugins/PluginPython.cpp +++ b/src/Editors/LevelEditor/Plugins/PluginPython.cpp @@ -33,8 +33,12 @@ xr_string CPluginPython::RunCommand(const xr_string& command) PROCESS_INFORMATION pi; xr_string cmd = "cmd /C " + command; + // Óêàçûâàåì ðàáî÷èé êàòàëîã + string_path Root; + FS.update_path(Root, "$fs_root$", ""); + // Ñîçäàåì ïðîöåññ - if (!CreateProcessA(nullptr, const_cast(cmd.c_str()), nullptr, nullptr, TRUE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) + if (!CreateProcessA(nullptr, const_cast(cmd.c_str()), nullptr, nullptr, TRUE, CREATE_NO_WINDOW, nullptr, Root, &si, &pi)) { CloseHandle(hRead); CloseHandle(hWrite); @@ -59,6 +63,7 @@ xr_string CPluginPython::RunCommand(const xr_string& command) CloseHandle(pi.hProcess); CloseHandle(pi.hThread); + output = Platform::ANSI_TO_UTF8(output); return output; } diff --git a/src/Editors/LevelEditor/Plugins/PluginsUIRun.cpp b/src/Editors/LevelEditor/Plugins/PluginsUIRun.cpp index 96b35b87e5..70fa38d130 100644 --- a/src/Editors/LevelEditor/Plugins/PluginsUIRun.cpp +++ b/src/Editors/LevelEditor/Plugins/PluginsUIRun.cpp @@ -21,6 +21,22 @@ void CPluginUIRun::Draw() continue; } + xr_string TestPath = Desc; + TestPath = TestPath.RemoveWhitespaces(); + if (FS.pathes.contains(TestPath.c_str())) + { + string_path FullPath = {}; + FS.update_path(FullPath, TestPath.c_str(), ""); + if (FullPath[strlen(FullPath) - 1] == '\\') + { + FullPath[strlen(FullPath) - 1] = '\0'; + } + + xr_string FixedPath = std::filesystem::absolute(FullPath).string().c_str(); + xr_strcpy(InputPlugin->InputArgsValues[Arg], FixedPath.c_str()); + continue; + } + ImGui::Text(Desc.c_str()); ImGui::InputText(("##" + Arg).c_str(), InputPlugin->InputArgsValues[Arg], 256);