From 33e2c1db1aa28ccb0d5821bb320952a42deb79b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=BF=97=E5=90=8C?= Date: Wed, 15 Nov 2023 10:56:19 +0800 Subject: [PATCH] Blockchain Storage Path (#315) * 283 * Update FileSystemExtensions.cs Co-authored-by: Christopher Schuchardt * Update src/neoxp/Extensions/FileSystemExtensions.cs Co-authored-by: Christopher Schuchardt --------- Co-authored-by: Jimmy Co-authored-by: Christopher Schuchardt --- src/neoxp/Extensions/FileSystemExtensions.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/neoxp/Extensions/FileSystemExtensions.cs b/src/neoxp/Extensions/FileSystemExtensions.cs index a47c8ec5..90fd3c4c 100644 --- a/src/neoxp/Extensions/FileSystemExtensions.cs +++ b/src/neoxp/Extensions/FileSystemExtensions.cs @@ -65,11 +65,16 @@ public static string GetNodePath(this IFileSystem fileSystem, ExpressConsensusNo var account = node.Wallet.Accounts.Single(a => a.IsDefault); - var rootPath = fileSystem.Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.DoNotVerify), - "Neo-Express", - "blockchain-nodes"); - return fileSystem.Path.Combine(rootPath, account.ScriptHash); + var homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.DoNotVerify); + var expressBlockchainDir = fileSystem.Path.Combine(homeDir, ".neo-express", "blockchain-nodes", account.ScriptHash); + + var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.DoNotVerify); + var expressOldBlockchainDir = fileSystem.Path.Combine(appData, "Neo-Express", "blockchain-nodes", account.ScriptHash); + + if (fileSystem.Directory.Exists(expressOldBlockchainDir)) + return expressOldBlockchainDir; + + return expressBlockchainDir; } public static async Task<(NefFile nefFile, ContractManifest manifest)> LoadContractAsync(this IFileSystem fileSystem, string contractPath)