|
| 1 | +# Configuration Path Update |
| 2 | + |
| 3 | +## Change Summary |
| 4 | + |
| 5 | +Updated the wallet storage location to use `~/.config/svmai/` directory instead of storing directly in the home directory. |
| 6 | + |
| 7 | +## Before |
| 8 | + |
| 9 | +**Storage Location:** `~/.svmai_wallets.json` |
| 10 | +- Wallet data stored directly in home directory |
| 11 | +- Hidden file (prefixed with `.`) |
| 12 | + |
| 13 | +## After |
| 14 | + |
| 15 | +**Storage Location:** `~/.config/svmai/wallets.json` |
| 16 | +- Follows XDG Base Directory specification |
| 17 | +- Organized in dedicated config directory |
| 18 | +- Separate from Solana's config directory (`~/.config/solana/`) |
| 19 | + |
| 20 | +## Changes Made |
| 21 | + |
| 22 | +### File: `src/secure_storage.rs` |
| 23 | + |
| 24 | +1. **Updated Constants:** |
| 25 | + ```rust |
| 26 | + // Before |
| 27 | + pub const CONFIG_FILE_NAME: &str = ".svmai_wallets.json"; |
| 28 | + |
| 29 | + // After |
| 30 | + pub const CONFIG_FILE_NAME: &str = "wallets.json"; |
| 31 | + pub const CONFIG_DIR_NAME: &str = "svmai"; |
| 32 | + ``` |
| 33 | + |
| 34 | +2. **Updated `get_config_path()` Function:** |
| 35 | + ```rust |
| 36 | + // Before |
| 37 | + dirs::home_dir() |
| 38 | + .map(|home| home.join(CONFIG_FILE_NAME)) |
| 39 | + |
| 40 | + // After |
| 41 | + dirs::config_dir() |
| 42 | + .map(|config_dir| config_dir.join(CONFIG_DIR_NAME).join(CONFIG_FILE_NAME)) |
| 43 | + ``` |
| 44 | + |
| 45 | +## Benefits |
| 46 | + |
| 47 | +1. **No Conflict with Solana:** Ensures svmai doesn't touch `~/.config/solana/` directory |
| 48 | +2. **Better Organization:** Follows standard config directory conventions |
| 49 | +3. **Platform Support:** Uses `dirs::config_dir()` which maps to: |
| 50 | + - Linux: `~/.config/svmai/` |
| 51 | + - macOS: `~/Library/Application Support/svmai/` |
| 52 | + - Windows: `%APPDATA%\svmai\` |
| 53 | + |
| 54 | +## Migration Note |
| 55 | + |
| 56 | +Existing users with wallets in `~/.svmai_wallets.json` will need to manually move their encrypted wallet data to the new location if they want to preserve their wallets. The application will create a fresh wallet store in the new location. |
| 57 | + |
| 58 | +## Verification |
| 59 | + |
| 60 | +Build and test completed successfully: |
| 61 | +- ✅ Application compiles without errors |
| 62 | +- ✅ Config path uses `~/.config/svmai/wallets.json` |
| 63 | +- ✅ No interaction with `~/.config/solana/` directory |
| 64 | +- ✅ Backward compatibility maintained through environment variable override for tests |
| 65 | + |
0 commit comments