mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 05:26:24 +02:00
Merge pull request #12550 from unknownbrackets/win-long-path
Attempt support for Windows long paths
This commit is contained in:
17 files changed
+269
-159
No files matched your search
+11
-3
@@ -313,10 +313,18 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) {
|
||||
|
||||
static std::string NormalizePath(const std::string &path) {
|
||||
#ifdef _WIN32
|
||||
wchar_t buf[512] = {0};
|
||||
std::wstring wpath = ConvertUTF8ToWString(path);
|
||||
if (GetFullPathName(wpath.c_str(), (int)ARRAY_SIZE(buf) - 1, buf, NULL) == 0)
|
||||
return "";
|
||||
std::wstring buf;
|
||||
buf.resize(512);
|
||||
size_t sz = GetFullPathName(wpath.c_str(), (DWORD)buf.size(), &buf[0], nullptr);
|
||||
if (sz != 0 && sz < buf.size()) {
|
||||
buf.resize(sz);
|
||||
} else if (sz > buf.size()) {
|
||||
buf.resize(sz);
|
||||
sz = GetFullPathName(wpath.c_str(), (DWORD)buf.size(), &buf[0], nullptr);
|
||||
// This should truncate off the null terminator.
|
||||
buf.resize(sz);
|
||||
}
|
||||
return ConvertWStringToUTF8(buf);
|
||||
#else
|
||||
char buf[PATH_MAX + 1];
|
||||
|
||||
Reference in new issue
Block a user