mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
sys: Bunch of cleanup, use fs::path instead of std::string for paths
This commit is contained in:
@@ -16,7 +16,7 @@ namespace hex {
|
||||
|
||||
class Plugin {
|
||||
public:
|
||||
Plugin(const std::string &path);
|
||||
Plugin(const fs::path &path);
|
||||
Plugin(const Plugin&) = delete;
|
||||
Plugin(Plugin &&other) noexcept;
|
||||
~Plugin();
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace hex {
|
||||
constexpr auto GetPluginDescriptionSymbol = "_ZN3hex6plugin{0}{1}8internal20getPluginDescriptionEv";
|
||||
constexpr auto SetImGuiContextSymbol = "_ZN3hex6plugin{0}{1}8internal15setImGuiContextEP12ImGuiContext";
|
||||
|
||||
Plugin::Plugin(const std::string &path) {
|
||||
this->m_handle = dlopen(path.data(), RTLD_LAZY);
|
||||
Plugin::Plugin(const fs::path &path) {
|
||||
this->m_handle = dlopen(path.string().c_str(), RTLD_LAZY);
|
||||
|
||||
if (this->m_handle == nullptr) {
|
||||
log::error("dlopen failed: {}", dlerror());
|
||||
|
||||
@@ -174,11 +174,11 @@ namespace hex {
|
||||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventFileLoaded>(this, [](const std::string &path){
|
||||
EventManager::subscribe<EventFileLoaded>(this, [](const auto &path){
|
||||
SharedData::recentFilePaths.push_front(path);
|
||||
|
||||
{
|
||||
std::list<std::string> uniques;
|
||||
std::list<fs::path> uniques;
|
||||
for (auto &file : SharedData::recentFilePaths) {
|
||||
|
||||
bool exists = false;
|
||||
@@ -198,7 +198,8 @@ namespace hex {
|
||||
|
||||
{
|
||||
std::vector<std::string> recentFilesVector;
|
||||
std::copy(SharedData::recentFilePaths.begin(), SharedData::recentFilePaths.end(), std::back_inserter(recentFilesVector));
|
||||
for (const auto &recentPath : SharedData::recentFilePaths)
|
||||
recentFilesVector.push_back(recentPath.string());
|
||||
|
||||
ContentRegistry::Settings::write("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.recent_files", recentFilesVector);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user