Fix utf8 handling when opening recent files

This commit is contained in:
Stepland 2023-04-02 23:18:04 +02:00
parent 0c9227a568
commit aa77bad015
2 changed files with 4 additions and 4 deletions

View File

@ -47,11 +47,11 @@ void Toolbox::pushNewRecentFile(std::filesystem::path file, std::filesystem::pat
writeFile.close(); writeFile.close();
} }
std::vector<std::string> Toolbox::getRecentFiles(std::filesystem::path settings) { std::vector<std::filesystem::path> Toolbox::getRecentFiles(std::filesystem::path settings) {
nowide::ifstream readFile{path_to_utf8_encoded_string(settings / recent_files_file)}; nowide::ifstream readFile{path_to_utf8_encoded_string(settings / recent_files_file)};
std::vector<std::string> recent; std::vector<std::filesystem::path> recent;
for (std::string line; getline(readFile, line);) { for (std::string line; getline(readFile, line);) {
recent.push_back(line); recent.push_back(to_path(line));
} }
readFile.close(); readFile.close();
return recent; return recent;

View File

@ -19,7 +19,7 @@
*/ */
namespace Toolbox { namespace Toolbox {
void pushNewRecentFile(std::filesystem::path file, std::filesystem::path settings); void pushNewRecentFile(std::filesystem::path file, std::filesystem::path settings);
std::vector<std::string> getRecentFiles(std::filesystem::path settings); std::vector<std::filesystem::path> getRecentFiles(std::filesystem::path settings);
struct CustomConstraints { struct CustomConstraints {
static void ContentSquare(ImGuiSizeCallbackData* data) { static void ContentSquare(ImGuiSizeCallbackData* data) {