mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-02-10 06:18:55 -06:00
sys: Tons of long overdue cleanup
- std::string -> const std::string& where needed - Added a FileIO abstraction class - Fixed recent files not updating - Removed localization file from global include - Renamed lang to pattern_language/pl - Renamed EventFileDropped to RequestFileOpen
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/paths.hpp>
|
||||
#include <hex/helpers/file.hpp>
|
||||
#include <hex/views/view.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
@@ -177,7 +178,7 @@ namespace hex {
|
||||
return createStructureType("union", args);
|
||||
}
|
||||
|
||||
bool LoaderScript::processFile(std::string_view scriptPath) {
|
||||
bool LoaderScript::processFile(const std::string &scriptPath) {
|
||||
Py_SetProgramName(Py_DecodeLocale((SharedData::mainArgv)[0], nullptr));
|
||||
|
||||
for (const auto &dir : hex::getPath(ImHexPath::Python)) {
|
||||
@@ -218,10 +219,8 @@ namespace hex {
|
||||
PyList_Insert(sysPath, 0, path);
|
||||
}
|
||||
|
||||
FILE *scriptFile = fopen(scriptPath.data(), "r");
|
||||
PyRun_SimpleFile(scriptFile, scriptPath.data());
|
||||
|
||||
fclose(scriptFile);
|
||||
File scriptFile(scriptPath, File::Mode::Read);
|
||||
PyRun_SimpleFile(scriptFile.getHandle(), scriptPath.c_str());
|
||||
|
||||
Py_Finalize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user