[READ-ONLY] Mirror of https://github.com/probablykasper/time-machine-inspector. Time Machine backup size inspector app
backup macos tauri time-machine
0

Configure Feed

Select the types of activity you want to include in your feed.

Simplify url open logic

Kasper (Feb 13, 2022, 1:45 AM +0100) 46bda97c 191aaffc

+9 -16
+1
src-tauri/Cargo.lock
··· 3152 3152 name = "time-machine-inspector" 3153 3153 version = "1.1.2" 3154 3154 dependencies = [ 3155 + "open", 3155 3156 "plist", 3156 3157 "serde", 3157 3158 "serde_json",
+2 -1
src-tauri/Cargo.toml
··· 9 9 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 10 11 11 [build-dependencies] 12 - tauri-build = { version = "1.0.0-rc.1" } 12 + tauri-build = { version = "1.0.0-rc.1", features = [] } 13 13 14 14 [dependencies] 15 15 serde_json = "1.0" ··· 17 17 tauri = { version = "1.0.0-rc.1", features = ["dialog-message", "shell-open"] } 18 18 tauri-plugin-vibrancy = { git = "https://github.com/tauri-apps/tauri-plugin-vibrancy", features = ["tauri-impl"] } 19 19 plist = { version = "1.3.1", features = ["serde"] } 20 + open = "2.0" 20 21 21 22 [features] 22 23 default = [ "custom-protocol" ]
+4 -8
src-tauri/src/cmd.rs
··· 5 5 use std::fs::File; 6 6 use std::process::ExitStatus; 7 7 use std::sync::{Mutex, MutexGuard}; 8 - use tauri::api::{dialog, shell}; 9 - use tauri::{command, regex, scope, State, Window}; 8 + use tauri::api::dialog; 9 + use tauri::{command, State, Window}; 10 10 11 11 pub fn parse_output(bytes: Vec<u8>) -> Result<String, String> { 12 12 match String::from_utf8(bytes) { ··· 46 46 3. Add and enable Time Machine Inspector on the right", 47 47 ); 48 48 49 - let link = "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"; 50 - let shell_scope = scope::ShellScope::new(scope::ShellScopeConfig { 51 - open: Some(regex::Regex::new("^x-apple.systempreferences:").unwrap()), 52 - scopes: HashMap::new(), 53 - }); 54 - shell::open(&shell_scope, link.to_string(), None).unwrap(); 49 + open::that("x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") 50 + .unwrap(); 55 51 56 52 return Ok(()); 57 53 }
+2 -7
src-tauri/src/main.rs
··· 3 3 windows_subsystem = "windows" 4 4 )] 5 5 6 - use std::collections::HashMap; 7 6 use std::thread; 8 7 use std::time::Instant; 9 8 use tauri::api::{dialog, shell}; 10 9 use tauri::{ 11 - command, regex, scope, CustomMenuItem, Manager, Menu, MenuEntry, MenuItem, Submenu, Window, 10 + command, CustomMenuItem, Manager, Menu, MenuEntry, MenuItem, Submenu, Window, 12 11 WindowBuilder, WindowUrl, 13 12 }; 14 13 ··· 123 122 let event_name = event.menu_item_id(); 124 123 match event_name { 125 124 "Learn More" => { 126 - let shell_scope = scope::ShellScope::new(scope::ShellScopeConfig { 127 - open: Some(regex::Regex::new("^https?://").unwrap()), 128 - scopes: HashMap::new(), 129 - }); 130 125 let link = "https://github.com/probablykasper/time-machine-inspector".to_string(); 131 - shell::open(&shell_scope, link, None).unwrap(); 126 + shell::open(&event.window().shell_scope(), link, None).unwrap(); 132 127 } 133 128 _ => {} 134 129 }