Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Common/File/FileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,21 +315,21 @@ static bool ResolvePathVista(const std::wstring &path, wchar_t *buf, DWORD bufSi
}
#endif

std::string ResolvePath(const std::string &path) {
std::string ResolvePath(std::string_view path) {
if (LOG_IO) {
INFO_LOG(Log::System, "ResolvePath %s", path.c_str());
INFO_LOG(Log::System, "ResolvePath %.*s", (int)path.size(), path.data());
}
if (SIMULATE_SLOW_IO) {
sleep_ms(100, "slow-io-sim");
}

if (startsWith(path, "http://") || startsWith(path, "https://")) {
return path;
return std::string(path);
}

if (Android_IsContentUri(path)) {
// Nothing to do? We consider these to only have one canonical form.
return path;
return std::string(path);
}

#ifdef _WIN32
Expand Down Expand Up @@ -370,12 +370,13 @@ std::string ResolvePath(const std::string &path) {

#elif PPSSPP_PLATFORM(IOS)
// Resolving has wacky effects on documents paths.
return path;
return std::string(path);
#else
std::unique_ptr<char[]> buf(new char[PATH_MAX + 32768]);
if (realpath(path.c_str(), buf.get()) == nullptr)
return path;
return buf.get();
std::string spath(path);
if (realpath(spath.c_str(), buf.get()) == nullptr)
return spath;
return std::string(buf.get());
#endif
}

Expand Down
3 changes: 2 additions & 1 deletion Common/File/FileUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <fstream>
#include <cstdio>
#include <string>
#include <string_view>
#include <time.h>
#include <cstdint>

Expand Down Expand Up @@ -56,7 +57,7 @@ enum OpenFlag {
int OpenFD(const Path &filename, OpenFlag flags);

// Resolves symlinks and similar.
std::string ResolvePath(const std::string &path);
std::string ResolvePath(std::string_view path);

// Returns true if file filename exists
bool Exists(const Path &path);
Expand Down
Loading
Loading