@@ -1814,17 +1814,21 @@ impl ClientOptions {
18141814 . unwrap_or_default ( )
18151815 }
18161816
1817- fn config_path ( ) -> Result < PathBuf , Error > {
1818- let mut config_dir = dirs:: config_dir ( ) . ok_or_else ( || anyhow ! (
1817+ fn config_path ( & self , file : & str ) -> Result < PathBuf , Error > {
1818+ let mut path = self . context_options . home_directory . clone ( ) . or_else ( dirs:: config_dir) . ok_or_else ( || anyhow ! (
18191819 "Default wallet directory is not supported in this platform: please specify storage and wallet paths"
18201820 ) ) ?;
1821- config_dir. push ( "linera" ) ;
1822- if !config_dir. exists ( ) {
1823- debug ! ( "Creating default wallet directory {}" , config_dir. display( ) ) ;
1824- fs_err:: create_dir_all ( & config_dir) ?;
1821+ path. push ( "linera" ) ;
1822+ if let Some ( name) = & self . context_options . with_wallet {
1823+ path. push ( name) ;
18251824 }
1826- info ! ( "Using default wallet directory {}" , config_dir. display( ) ) ;
1827- Ok ( config_dir)
1825+ if !path. exists ( ) {
1826+ debug ! ( "Creating default wallet directory {}" , path. display( ) ) ;
1827+ fs_err:: create_dir_all ( & path) ?;
1828+ }
1829+ path. push ( file) ;
1830+ info ! ( "Using wallet path {}" , path. display( ) ) ;
1831+ Ok ( path)
18281832 }
18291833
18301834 fn storage_config ( & self ) -> Result < StorageConfig , Error > {
@@ -1834,14 +1838,15 @@ impl ClientOptions {
18341838 let suffix = self . suffix ( ) ;
18351839 let storage_env_var = env:: var ( format ! ( "LINERA_STORAGE{suffix}" ) ) . ok ( ) ;
18361840 if let Some ( config) = storage_env_var {
1841+ warn ! ( "LINERA_STORAGE_* is deprecated. Use --with-wallet=NAME or --storage=CONFIG instead." ) ;
18371842 return config. parse ( ) ;
18381843 }
18391844 cfg_if:: cfg_if! {
18401845 if #[ cfg( feature = "rocksdb" ) ] {
18411846 let spawn_mode =
18421847 linera_views:: rocks_db:: RocksDbSpawnMode :: get_spawn_mode_from_runtime( ) ;
18431848 let inner_storage_config = linera_service:: storage:: InnerStorageConfig :: RocksDb {
1844- path: Self :: config_path( ) ? . join ( "wallet.db" ) ,
1849+ path: self . config_path( "wallet.db" ) ? ,
18451850 spawn_mode,
18461851 } ;
18471852 let namespace = "default" . to_string( ) ;
@@ -1857,28 +1862,30 @@ impl ClientOptions {
18571862
18581863 fn wallet_path ( & self ) -> Result < PathBuf , Error > {
18591864 if let Some ( path) = & self . context_options . wallet_state_path {
1865+ warn ! ( "Option --wallet is deprecated. Use --with-wallet=NAME instead." ) ;
18601866 return Ok ( path. clone ( ) ) ;
18611867 }
18621868 let suffix = self . suffix ( ) ;
18631869 let wallet_env_var = env:: var ( format ! ( "LINERA_WALLET{suffix}" ) ) . ok ( ) ;
18641870 if let Some ( path) = wallet_env_var {
1871+ warn ! ( "LINERA_WALLET_* is deprecated. Use --with-wallet=NAME instead." ) ;
18651872 return Ok ( path. parse ( ) ?) ;
18661873 }
1867- let config_path = Self :: config_path ( ) ?;
1868- Ok ( config_path. join ( "wallet.json" ) )
1874+ self . config_path ( "wallet.json" )
18691875 }
18701876
18711877 fn keystore_path ( & self ) -> Result < PathBuf , Error > {
18721878 if let Some ( path) = & self . context_options . keystore_path {
1879+ warn ! ( "Option --keystore is deprecated. Use --with-wallet=NAME instead." ) ;
18731880 return Ok ( path. clone ( ) ) ;
18741881 }
18751882 let suffix = self . suffix ( ) ;
18761883 let keystore_env_var = env:: var ( format ! ( "LINERA_KEYSTORE{suffix}" ) ) . ok ( ) ;
18771884 if let Some ( path) = keystore_env_var {
1885+ warn ! ( "LINERA_KEYSTORE_* is deprecated. Use --with-wallet=NAME instead." ) ;
18781886 return Ok ( path. parse ( ) ?) ;
18791887 }
1880- let config_path = Self :: config_path ( ) ?;
1881- Ok ( config_path. join ( "keystore.json" ) )
1888+ self . config_path ( "keystore.json" )
18821889 }
18831890
18841891 pub fn create_wallet (
0 commit comments