Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

PC: open the photo backup folder on each platform (#37)

Sai Vinay Kumar Reddy Vavilla9829916544d0
diff --git a/desktop/app/cpp/native_window.h b/desktop/app/cpp/native_window.h
index fc253b3..ad06b6b 100644
--- a/desktop/app/cpp/native_window.h
+++ b/desktop/app/cpp/native_window.h
@@ -18,7 +18,6 @@ class NativeWindow : public QQuickWindow
Q_OBJECT
QML_ELEMENT
-
// Show Mica behind transparent areas.
Q_PROPERTY(bool backdrop READ backdrop WRITE setBackdrop NOTIFY backdropChanged)
// Use Windows 11 Desktop Acrylic (DWMSBT_TRANSIENTWINDOW) when backdrop is active (for Liquid Glass theme).
diff --git a/desktop/app/src/bridge/photo_backup.rs b/desktop/app/src/bridge/photo_backup.rs
index d4b94e6..87828c5 100644
--- a/desktop/app/src/bridge/photo_backup.rs
+++ b/desktop/app/src/bridge/photo_backup.rs
@@ -158,7 +158,7 @@ impl qobject::PhotoBackup {
let name = core_host::host().hub.read(|s| s.name_of(&id)).unwrap_or_default();
let folder = photo_backup::summary(id, &name).folder;
if std::fs::create_dir_all(&folder).is_ok()
- && let Err(e) = std::process::Command::new("explorer.exe").arg(&folder).spawn()
+ && let Err(e) = crate::win::shell::open_folder(&folder)
{
tracing::warn!(error = %e, "can't open the photo backup folder");
}
diff --git a/desktop/app/src/mac/shell.rs b/desktop/app/src/mac/shell.rs
index 5d0171f..185f34d 100644
--- a/desktop/app/src/mac/shell.rs
+++ b/desktop/app/src/mac/shell.rs
@@ -71,6 +71,11 @@ pub fn sleep() -> Result<(), String> {
std::process::Command::new("pmset").arg("sleepnow").spawn().map(|_| ()).map_err(|e| e.to_string())
}
+/// Opens a directory in Finder.
+pub fn open_folder(path: &Path) -> Result<(), String> {
+ std::process::Command::new("open").arg(path).spawn().map(|_| ()).map_err(|e| e.to_string())
+}
+
/// Launches an application bundle or executable.
pub fn launch_app(path: &Path) -> Result<(), String> {
std::process::Command::new("open").arg(path).spawn().map(|_| ()).map_err(|e| e.to_string())
diff --git a/desktop/app/src/win/shell.rs b/desktop/app/src/win/shell.rs
index 06d7444..75fc336 100644
--- a/desktop/app/src/win/shell.rs
+++ b/desktop/app/src/win/shell.rs
@@ -188,6 +188,11 @@ pub fn launch_app(path: &std::path::Path) -> Result<(), String> {
if result.0 as isize > 32 { Ok(()) } else { Err(format!("ShellExecute returned {}", result.0 as isize)) }
}
+/// Opens a directory in File Explorer.
+pub fn open_folder(path: &std::path::Path) -> Result<(), String> {
+ std::process::Command::new("explorer.exe").arg(path).spawn().map(|_| ()).map_err(|e| e.to_string())
+}
+
/// Runs a PC-configured shell command (`cmd.exe /C <command>`) without flashing
/// a console window.
pub fn run_command(command: &str) -> Result<(), String> {