mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 07:46:01 +03:00
[PR #1064] [MERGED] Use fs::path::native whenever possible, avoid unnecessary fs->string conversions in GUI code #1910
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#1910
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/1064
Author: @OFFTKP
Created: 9/25/2024
Status: ✅ Merged
Merged: 9/26/2024
Merged by: @georgemoralis
Base:
main← Head:wstr📝 Commits (10+)
662ae57Use filesystem::path whenever possible, remove fs::path::string9a4f57eMy hatred for Windows grows with every passing day3640783More Qt stuff43aeee7custom u8string formatter for fmt library481c3d0Merge pull request #1 from viniciuslrangel/str-fmt4fd41bfUse u8string for imgui87b8342Fix toml errors hopefully51d21a2Fix not printing issue62a3f1cOh and on SDL265698dI hate Windows even more today📊 Changes
30 files changed (+271 additions, -125 deletions)
View changed files
📝
src/common/config.cpp(+31 -10)📝
src/common/config.h(+2 -2)📝
src/common/logging/formatter.h(+21 -0)📝
src/common/memory_patcher.cpp(+4 -4)📝
src/common/path_util.cpp(+22 -0)📝
src/common/path_util.h(+23 -0)📝
src/core/file_format/pkg.cpp(+2 -3)📝
src/core/file_format/splash.cpp(+2 -2)📝
src/core/file_format/splash.h(+2 -1)📝
src/core/file_format/trp.cpp(+1 -1)📝
src/core/libraries/np_trophy/np_trophy.cpp(+2 -2)📝
src/core/libraries/save_data/save_backup.cpp(+7 -5)📝
src/core/libraries/save_data/save_memory.cpp(+3 -2)📝
src/core/libraries/save_data/savedata.cpp(+2 -2)📝
src/emulator.cpp(+3 -3)📝
src/imgui/renderer/imgui_core.cpp(+12 -4)📝
src/main.cpp(+8 -0)📝
src/qt_gui/cheats_patches.cpp(+18 -15)📝
src/qt_gui/game_grid_frame.cpp(+6 -7)📝
src/qt_gui/game_info.cpp(+4 -2)...and 10 more files
📄 Description
The problem is that
std::filesystem::path::stringthrows an exception on Windows if the path contains special characters.This causes the emulator to mysteriously crash with no immediately obvious error on Windows if the executable (or config files or other paths used by the GUI) are in some path that contains special characters (such as Cyrillic, Spanish etc.)
This has been a very annoying problem that gets a lot of users to report it in discord, and it's not easy to solve because a lot of times users don't know what a path is.
The native string format used on Windows for paths is wstring, which supports special characters. On POSIX it's regular old std::string. path::native returns the correct type based on OS.
This PR reduces some unnecessary uses of
path::stringby using the fs::path itself, and opts forpath::nativeon the rest.An annoying side effect is that fmt::format & co (for good reason) doesn't allow you to:
Lin front of the format stringEmulator code that does path->string conversions was ignored because there was a lot of them in logging facilities which are the most annoying to deal with, and most likely there isn't going to be any paths with wide characters used in games
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.