mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Use execvp() instead of system() on Linux (#1170)
This PR it just a hack to fix #1160 , it doesn't solve the underlying problem. It fixes the problem because by using execvp() directly, it avoids the call to `sh` done with `system()`, which has a bug on Ubuntu 22.04 which makes it i,compatibles with the glibc inside the AppImage. It doesn't fix the underlying problem because the programs we call themselves still link to the AppImage's libraries instead of the system ones.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
#include <hex/helpers/utils_linux.hpp>
|
||||
|
||||
#include <xdg.hpp>
|
||||
|
||||
@@ -43,9 +44,7 @@ namespace hex::fs {
|
||||
hex::format("open {}", wolv::util::toUTF8String(filePath)).c_str()
|
||||
));
|
||||
#elif defined(OS_LINUX)
|
||||
hex::unused(system(
|
||||
hex::format("xdg-open {}", wolv::util::toUTF8String(filePath)).c_str()
|
||||
));
|
||||
executeCmd({"xdg-open", wolv::util::toUTF8String(filePath)});
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -62,9 +61,7 @@ namespace hex::fs {
|
||||
hex::format("open {}", wolv::util::toUTF8String(dirPath)).c_str()
|
||||
));
|
||||
#elif defined(OS_LINUX)
|
||||
hex::unused(system(
|
||||
hex::format("xdg-open {}", wolv::util::toUTF8String(dirPath)).c_str()
|
||||
));
|
||||
executeCmd({"xdg-open", wolv::util::toUTF8String(dirPath)});
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -87,9 +84,7 @@ namespace hex::fs {
|
||||
#elif defined(OS_LINUX)
|
||||
// fallback to only opening the folder for now
|
||||
// TODO actually select the file
|
||||
hex::unused(system(
|
||||
hex::format("xdg-open {}", wolv::util::toUTF8String(selectedFilePath.parent_path())).c_str()
|
||||
));
|
||||
executeCmd({"xdg-open", wolv::util::toUTF8String(selectedFilePath.parent_path())});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user