mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-10 00:05:07 +00:00
UI: Automatically forget pinned deleted paths.
Also, resolve the paths in case of symlinks.
This commit is contained in:
parent
562c5f6485
commit
246234b0b7
@ -1037,7 +1037,10 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
|
||||
vPinnedPaths.clear();
|
||||
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
|
||||
vPinnedPaths.push_back(it->second);
|
||||
// Unpin paths that are deleted automatically.
|
||||
if (File::Exists(it->second)) {
|
||||
vPinnedPaths.push_back(File::ResolvePath(it->second));
|
||||
}
|
||||
}
|
||||
|
||||
// This caps the exponent 4 (so 16x.)
|
||||
|
@ -495,10 +495,11 @@ UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) {
|
||||
|
||||
UI::EventReturn GameBrowser::PinToggleClick(UI::EventParams &e) {
|
||||
auto &pinnedPaths = g_Config.vPinnedPaths;
|
||||
const std::string path = File::ResolvePath(path_.GetPath());
|
||||
if (IsCurrentPathPinned()) {
|
||||
pinnedPaths.erase(std::remove(pinnedPaths.begin(), pinnedPaths.end(), path_.GetPath()), pinnedPaths.end());
|
||||
pinnedPaths.erase(std::remove(pinnedPaths.begin(), pinnedPaths.end(), path), pinnedPaths.end());
|
||||
} else {
|
||||
pinnedPaths.push_back(path_.GetPath());
|
||||
pinnedPaths.push_back(path);
|
||||
}
|
||||
Refresh();
|
||||
return UI::EVENT_DONE;
|
||||
@ -662,7 +663,7 @@ void GameBrowser::Refresh() {
|
||||
|
||||
bool GameBrowser::IsCurrentPathPinned() {
|
||||
const auto paths = g_Config.vPinnedPaths;
|
||||
return std::find(paths.begin(), paths.end(), path_.GetPath()) != paths.end();
|
||||
return std::find(paths.begin(), paths.end(), File::ResolvePath(path_.GetPath())) != paths.end();
|
||||
}
|
||||
|
||||
const std::vector<std::string> GameBrowser::GetPinnedPaths() {
|
||||
@ -672,7 +673,7 @@ const std::vector<std::string> GameBrowser::GetPinnedPaths() {
|
||||
static const std::string sepChars = "/\\";
|
||||
#endif
|
||||
|
||||
const std::string currentPath = path_.GetPath();
|
||||
const std::string currentPath = File::ResolvePath(path_.GetPath());
|
||||
const std::vector<std::string> paths = g_Config.vPinnedPaths;
|
||||
std::vector<std::string> results;
|
||||
for (size_t i = 0; i < paths.size(); ++i) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user