| … | … | @@ -152,10 +152,20 @@ export class FileManager { |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | | * Get the ~/.hyperident/ directory path cross-platform |
| 155 | * Override the default vault path. Call before any identity operations. |
| 156 | * @param {string} customPath - absolute path to use instead of ~/.hyperident |
| 157 | */ |
| 158 | static setBasePath(customPath) { |
| 159 | FileManager._customPath = customPath |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Get the hyperident directory path. |
| 164 | * Returns custom path if set via setBasePath(), otherwise ~/.hyperident/ |
| 156 | 165 | * @returns {string} Full path to hyperident directory |
| 157 | 166 | */ |
| 158 | 167 | static getHyperidentPath() { |
| 168 | if (FileManager._customPath) return FileManager._customPath |
| 159 | 169 | const homeDir = os.homedir() |
| 160 | 170 | return path.join(homeDir, '.hyperident') |
| 161 | 171 | } |