summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/lldir.cpp
diff options
context:
space:
mode:
authorCarbon Cowboy <254348425+carboncowboy@users.noreply.github.com>2026-01-31 21:59:51 -0800
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-02-03 12:16:53 +0200
commit82ff4344f65f91c3536212ecd06934d389b2063e (patch)
tree696bcc49b94d68e0a2c9bf0bcdb2dac7defffb08 /indra/llfilesystem/lldir.cpp
parent778bf6c1aa7ed608b5d857574944a7fbc19c3638 (diff)
Add clickable notification for saved screenshots
Display notification with filepath after screenshot is saved to disk. Clicking the notification opens the system file browser to reveal the saved file. Fixes #5329
Diffstat (limited to 'indra/llfilesystem/lldir.cpp')
-rw-r--r--indra/llfilesystem/lldir.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index 190539cea5..7d547ca4be 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -44,6 +44,7 @@
#include "stringize.h"
#include "llstring.h"
#include <boost/filesystem.hpp>
+#include "llprocess.h"
#include <boost/bind.hpp>
#include <algorithm>
@@ -1100,6 +1101,52 @@ LLDir::SepOff LLDir::needSep(const std::string& path, const std::string& name) c
return SepOff(false, 0);
}
+void LLDir::openDir(const std::string& filepath)
+{
+ if (filepath.empty())
+ {
+ LL_WARNS() << "Cannot open file browser: filepath is empty" << LL_ENDL;
+ return;
+ }
+
+ // Extract directory path from full filepath
+ std::string dir_path = getDirName(filepath);
+
+ LLProcess::Params params;
+
+#if LL_WINDOWS
+ // Windows: Use explorer.exe with /select flag to highlight the file
+ std::string system_root = LLStringUtil::getenv("SystemRoot", "C:\\Windows");
+ params.executable = system_root + "\\explorer.exe";
+ params.args.add("/select,");
+ params.args.add(filepath);
+#elif LL_DARWIN
+ // macOS: Use 'open' command with -R flag to reveal in Finder
+ params.executable = "/usr/bin/open";
+ params.args.add("-R");
+ params.args.add(filepath);
+#elif LL_LINUX
+ // Linux: Use xdg-open to open the directory
+ // Note: Most file managers don't support file selection, so we open the directory
+ params.executable = "/usr/bin/xdg-open";
+ params.args.add(dir_path);
+#else
+ LL_WARNS() << "Platform not supported for file browser opening" << LL_ENDL;
+ return;
+#endif
+
+ params.autokill = false; // Don't kill the file browser when viewer exits
+
+ if (!LLProcess::create(params))
+ {
+ LL_WARNS() << "Failed to open file browser for: " << filepath << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Opened file browser for: " << filepath << LL_ENDL;
+ }
+}
+
void dir_exists_or_crash(const std::string &dir_name)
{
#if LL_WINDOWS