@@ -1767,17 +1767,21 @@ impl ClientOptions {
17671767 . unwrap_or_default ( )
17681768 }
17691769
1770- fn config_path ( ) -> Result < PathBuf , Error > {
1771- let mut config_dir = dirs:: config_dir ( ) . ok_or_else ( || anyhow ! (
1770+ fn config_path ( & self , file : & str ) -> Result < PathBuf , Error > {
1771+ let mut path = self . context_options . home_directory . clone ( ) . or_else ( dirs:: config_dir) . ok_or_else ( || anyhow ! (
17721772 "Default wallet directory is not supported in this platform: please specify storage and wallet paths"
17731773 ) ) ?;
1774- config_dir. push ( "linera" ) ;
1775- if !config_dir. exists ( ) {
1776- debug ! ( "Creating default wallet directory {}" , config_dir. display( ) ) ;
1777- fs_err:: create_dir_all ( & config_dir) ?;
1774+ path. push ( "linera" ) ;
1775+ if let Some ( name) = & self . context_options . with_wallet {
1776+ path. push ( name) ;
17781777 }
1779- info ! ( "Using default wallet directory {}" , config_dir. display( ) ) ;
1780- Ok ( config_dir)
1778+ if !path. exists ( ) {
1779+ debug ! ( "Creating default wallet directory {}" , path. display( ) ) ;
1780+ fs_err:: create_dir_all ( & path) ?;
1781+ }
1782+ path. push ( file) ;
1783+ info ! ( "Using wallet path {}" , path. display( ) ) ;
1784+ Ok ( path)
17811785 }
17821786
17831787 fn storage_config ( & self ) -> Result < StorageConfig , Error > {
@@ -1787,14 +1791,15 @@ impl ClientOptions {
17871791 let suffix = self . suffix ( ) ;
17881792 let storage_env_var = env:: var ( format ! ( "LINERA_STORAGE{suffix}" ) ) . ok ( ) ;
17891793 if let Some ( config) = storage_env_var {
1794+ warn ! ( "LINERA_STORAGE_* is deprecated. Use --with-wallet=NAME or --storage=CONFIG instead." ) ;
17901795 return config. parse ( ) ;
17911796 }
17921797 cfg_if:: cfg_if! {
17931798 if #[ cfg( feature = "rocksdb" ) ] {
17941799 let spawn_mode =
17951800 linera_views:: rocks_db:: RocksDbSpawnMode :: get_spawn_mode_from_runtime( ) ;
17961801 let inner_storage_config = linera_service:: storage:: InnerStorageConfig :: RocksDb {
1797- path: Self :: config_path( ) ? . join ( "wallet.db" ) ,
1802+ path: self . config_path( "wallet.db" ) ? ,
17981803 spawn_mode,
17991804 } ;
18001805 let namespace = "default" . to_string( ) ;
@@ -1810,28 +1815,30 @@ impl ClientOptions {
18101815
18111816 fn wallet_path ( & self ) -> Result < PathBuf , Error > {
18121817 if let Some ( path) = & self . context_options . wallet_state_path {
1818+ warn ! ( "Option --wallet is deprecated. Use --with-wallet=NAME instead." ) ;
18131819 return Ok ( path. clone ( ) ) ;
18141820 }
18151821 let suffix = self . suffix ( ) ;
18161822 let wallet_env_var = env:: var ( format ! ( "LINERA_WALLET{suffix}" ) ) . ok ( ) ;
18171823 if let Some ( path) = wallet_env_var {
1824+ warn ! ( "LINERA_WALLET_* is deprecated. Use --with-wallet=NAME instead." ) ;
18181825 return Ok ( path. parse ( ) ?) ;
18191826 }
1820- let config_path = Self :: config_path ( ) ?;
1821- Ok ( config_path. join ( "wallet.json" ) )
1827+ self . config_path ( "wallet.json" )
18221828 }
18231829
18241830 fn keystore_path ( & self ) -> Result < PathBuf , Error > {
18251831 if let Some ( path) = & self . context_options . keystore_path {
1832+ warn ! ( "Option --keystore is deprecated. Use --with-wallet=NAME instead." ) ;
18261833 return Ok ( path. clone ( ) ) ;
18271834 }
18281835 let suffix = self . suffix ( ) ;
18291836 let keystore_env_var = env:: var ( format ! ( "LINERA_KEYSTORE{suffix}" ) ) . ok ( ) ;
18301837 if let Some ( path) = keystore_env_var {
1838+ warn ! ( "LINERA_KEYSTORE_* is deprecated. Use --with-wallet=NAME instead." ) ;
18311839 return Ok ( path. parse ( ) ?) ;
18321840 }
1833- let config_path = Self :: config_path ( ) ?;
1834- Ok ( config_path. join ( "keystore.json" ) )
1841+ self . config_path ( "keystore.json" )
18351842 }
18361843
18371844 pub fn create_wallet (
0 commit comments