From a83de5ed6d5aae410d479d26060491a98505ea7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 11 Dec 2023 18:43:01 +0100 Subject: [PATCH] Pretty print cloud cache path in recent files Similarly to how $HOME is handled, shorten and pretty-print path to files stored in Poedit's cache of cloud-synced files. --- src/recent_files.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/recent_files.cpp b/src/recent_files.cpp index 4c4a6bd580..164d75252c 100644 --- a/src/recent_files.cpp +++ b/src/recent_files.cpp @@ -204,6 +204,11 @@ wxString pretty_print_path(wxFileName f) // shorten the path for visual use: auto path = f.GetPath(); + auto cloud = wxFileName::DirName(PoeditApp::GetCacheDir("Cloud")); + cloud.ReplaceHomeDir(); + if (path.StartsWith(cloud.GetFullPath())) + path = _("Cloud") + L" → " + path.substr(cloud.GetFullPath().length()); + #ifdef __WXMSW__ // ReplaceHomeDir() puts tilde at the beginning to replace $HOME, but this is uncommon on Windows, // so remove it and just use plain path: