File tree Expand file tree Collapse file tree 5 files changed +48
-1
lines changed
Expand file tree Collapse file tree 5 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ unstable = []
2828asimov-module = { version = " 25.0.0-dev.18" , default-features = true }
2929clap = { version = " 4.5" , default-features = false , features = [
3030 " std" ,
31+ " string" ,
3132], optional = true }
3233clientele = { version = " 0.3.8" , default-features = false , features = [
3334 " clap" ,
Original file line number Diff line number Diff line change 1+ // This is free and unencumbered software released into the public domain.
2+
3+ #[ derive( Debug ) ]
4+ pub struct SignalDir { }
Original file line number Diff line number Diff line change @@ -7,3 +7,11 @@ extern crate alloc;
77
88mod classes;
99pub use classes:: * ;
10+
11+ mod dir;
12+ pub use dir:: * ;
13+
14+ #[ cfg( feature = "std" ) ]
15+ mod path;
16+ #[ cfg( feature = "std" ) ]
17+ pub use path:: * ;
Original file line number Diff line number Diff line change 1+ // This is free and unencumbered software released into the public domain.
2+
3+ extern crate std;
4+
5+ use asimov_module:: getenv;
6+ use std:: path:: PathBuf ;
7+
8+ #[ cfg( unix) ]
9+ /// See: https://support.signal.org/hc/en-us/articles/360007059752-Backup-and-Restore-Messages
10+ /// See: https://github.com/signalapp/Signal-Desktop/blob/main/CONTRIBUTING.md#the-staging-environment
11+ pub fn default_signal_path ( ) -> PathBuf {
12+ let mut result: PathBuf = getenv:: home ( ) . unwrap ( ) . into ( ) ;
13+ #[ cfg( target_os = "macos" ) ]
14+ result. push ( "Library/Application Support/Signal" ) ;
15+ #[ cfg( not( target_os = "macos" ) ) ]
16+ result. push ( ".config/Signal" ) ;
17+ result
18+ }
19+
20+ #[ cfg( windows) ]
21+ /// See: https://support.signal.org/hc/en-us/articles/360007059752-Backup-and-Restore-Messages
22+ /// See: https://github.com/signalapp/Signal-Desktop/blob/main/CONTRIBUTING.md#the-staging-environment
23+ pub fn default_signal_path ( ) -> PathBuf {
24+ let mut result: PathBuf = getenv:: appdata ( ) . unwrap ( ) . into ( ) ;
25+ #[ cfg( target_os = "windows" ) ]
26+ result. push ( r"Roaming\Signal" ) ;
27+ result
28+ }
29+
30+ #[ cfg( all( not( unix) , not( windows) ) ) ]
31+ pub fn default_signal_path ( ) -> PathBuf {
32+ todo ! ( "implement default_signal_path for this platform" ) // TODO
33+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use asimov_module::{
88 json:: SkipNulls ,
99 secrecy:: ExposeSecret ,
1010} ;
11+ use asimov_signal_module:: default_signal_path;
1112use clap:: Parser ;
1213use clientele:: StandardOptions ;
1314use rusqlite:: { Connection , OpenFlags , Result } ;
@@ -26,7 +27,7 @@ struct Options {
2627 output : Option < String > ,
2728
2829 /// Path to the (unencrypted!) Signal database file
29- #[ clap( value_name = "SIGNAL-DB-FILE" ) ]
30+ #[ clap( value_name = "SIGNAL-DB-FILE" , default_value = default_signal_path ( ) . into_os_string ( ) ) ]
3031 path : PathBuf ,
3132}
3233
You can’t perform that action at this time.
0 commit comments