mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 11:43:47 +01:00
Path code cleanup, move some UI code (#21037)
* Move a bunch of path logic into Core/Util/PathUtil.cpp/h . * Move GameImageView out from SaveDataScreen * More cleanup, add a translation string
This commit is contained in:
1 parent
3116eba395
commit
b8fced5b41
72 files changed
+416
-330
No files matched your search
@@ -329,6 +329,7 @@ static bool ResolvePathVista(const std::wstring &path, wchar_t *buf, DWORD bufSi
|
||||
}
|
||||
#endif
|
||||
|
||||
// Canonicalize the given path, resolving symlinks, relative paths, etc.
|
||||
std::string ResolvePath(std::string_view path) {
|
||||
if (LOG_IO) {
|
||||
INFO_LOG(Log::IO, "ResolvePath %.*s", (int)path.size(), path.data());
|
||||
|
||||
@@ -204,31 +204,6 @@ void PathBrowser::ResetPending() {
|
||||
pendingPath_.clear();
|
||||
}
|
||||
|
||||
std::string PathBrowser::GetFriendlyPath() const {
|
||||
// Show relative to memstick root if there.
|
||||
if (path_.StartsWith(aliasMatch_)) {
|
||||
std::string p;
|
||||
if (aliasMatch_.ComputePathTo(path_, p)) {
|
||||
return aliasDisplay_ + p;
|
||||
}
|
||||
std::string str = path_.ToString();
|
||||
if (aliasMatch_.size() < str.length()) {
|
||||
return aliasDisplay_ + str.substr(aliasMatch_.size());
|
||||
} else {
|
||||
return aliasDisplay_;
|
||||
}
|
||||
}
|
||||
|
||||
std::string str = path_.ToString();
|
||||
#if !PPSSPP_PLATFORM(ANDROID) && (PPSSPP_PLATFORM(LINUX) || PPSSPP_PLATFORM(MAC))
|
||||
char *home = getenv("HOME");
|
||||
if (home != nullptr && !strncmp(str.c_str(), home, strlen(home))) {
|
||||
return std::string("~") + str.substr(strlen(home));
|
||||
}
|
||||
#endif
|
||||
return path_.ToVisualString();
|
||||
}
|
||||
|
||||
bool PathBrowser::GetListing(std::vector<File::FileInfo> &fileInfo, const char *extensionFilter, bool *cancel) {
|
||||
std::unique_lock<std::mutex> guard(pendingLock_);
|
||||
while (!IsListingReady() && (!cancel || !*cancel)) {
|
||||
|
||||
@@ -36,15 +36,10 @@ public:
|
||||
const Path &GetPath() const {
|
||||
return path_;
|
||||
}
|
||||
std::string GetFriendlyPath() const;
|
||||
|
||||
void SetUserAgent(std::string_view s) {
|
||||
userAgent_ = s;
|
||||
}
|
||||
void SetRootAlias(std::string_view alias, const Path &rootPath) {
|
||||
aliasDisplay_ = alias;
|
||||
aliasMatch_ = rootPath;
|
||||
}
|
||||
void RestrictToRoot(const Path &root);
|
||||
bool empty() const {
|
||||
return path_.empty();
|
||||
@@ -62,8 +57,6 @@ private:
|
||||
Path pendingPath_;
|
||||
Path restrictedRoot_;
|
||||
std::string userAgent_;
|
||||
std::string aliasDisplay_;
|
||||
Path aliasMatch_;
|
||||
std::vector<File::FileInfo> pendingFiles_;
|
||||
std::condition_variable pendingCond_;
|
||||
std::mutex pendingLock_;
|
||||
|
||||
Reference in new issue
Block a user