File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,25 @@ struct PublicKey {
6262}
6363
6464fn keys_file ( ) -> std:: path:: PathBuf {
65- if let Ok ( config_home) = std:: env:: var ( "XDG_CONFIG_HOME" ) {
66- std:: path:: PathBuf :: from ( config_home) . join ( "pkgx/bpb.toml" )
67- } else {
68- std:: path:: PathBuf :: from ( std:: env:: var ( "HOME" ) . unwrap ( ) ) . join ( ".config/pkgx/bpb.toml" )
69- }
65+ // for archaic reasons we first check the config path
66+ // however this is an error, we shouldn’t store this as config seeing as it is
67+ // tied to the private key which is likely a host setting and should not thus be
68+ // synced between machines
69+
70+ let config_path = if let Ok ( config_home) = std:: env:: var ( "XDG_CONFIG_HOME" ) {
71+ std:: path:: PathBuf :: from ( config_home) . join ( "pkgx/bpb.toml" )
72+ } else {
73+ std:: path:: PathBuf :: from ( std:: env:: var ( "HOME" ) . unwrap ( ) ) . join ( ".config/pkgx/bpb.toml" )
74+ } ;
75+
76+ if config_path. exists ( ) {
77+ config_path
78+ } else {
79+ let data_path = if let Ok ( data_home) = std:: env:: var ( "XDG_DATA_HOME" ) {
80+ std:: path:: PathBuf :: from ( data_home) . join ( "pkgx/bpb.toml" )
81+ } else {
82+ std:: path:: PathBuf :: from ( std:: env:: var ( "HOME" ) . unwrap ( ) ) . join ( ".local/share/pkgx/bpb.toml" )
83+ } ;
84+ data_path
85+ }
7086}
You can’t perform that action at this time.
0 commit comments