New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make datafolder to appdata, and its linux equivalent #34
Milestone
Comments
nopara73
changed the title
Make datafolder in appdata, and its linux equivalent
Make datafolder to appdata, and its linux equivalent
Sep 27, 2017
I've done this with a service in Windows and Linux (and Mac) so am happy to pick this up at some point. In Windows the folder location varies by which OS it is - so I've code I can re-use here to handle this. |
Sounds good. Just pay attention not to conflict with Electron's stuff. It messes into the appdata folder. For reference, this is how Stratis and NTumbleBit is going it: /// <summary>
/// Finds a location of the default data directory respecting different operating system specifics.
/// </summary>
/// <param name="appName">Name of the node, which will be reflected in the name of the data directory.</param>
/// <param name="network">Specification of the network the node runs on - regtest/testnet/mainnet.</param>
private void SetDefaultDataDir(string appName, Network network)
{
string directory = null;
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var home = Environment.GetEnvironmentVariable("HOME");
if (!string.IsNullOrEmpty(home))
{
this.Logger.LogInformation("Using HOME environment variable for initializing application data.");
directory = Path.Combine(home, "." + appName.ToLowerInvariant());
}
else
{
throw new DirectoryNotFoundException("Could not find suitable datadir");
}
}
else
{
var localAppData = Environment.GetEnvironmentVariable("APPDATA");
if (!string.IsNullOrEmpty(localAppData))
{
this.Logger.LogInformation("Using APPDATA environment variable for initializing application data.");
directory = Path.Combine(localAppData, appName);
}
else
{
throw new DirectoryNotFoundException("Could not find suitable datadir");
}
}
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
directory = Path.Combine(directory, network.Name);
if (!Directory.Exists(directory))
{
this.Logger.LogInformation("Creating data directory...");
Directory.CreateDirectory(directory);
}
this.DataDir = directory;
} |
Done. |
nopara73
added a commit
that referenced
this issue
Apr 9, 2018
Improve getfeesasync nopara73/MagicalCryptoWallet#10
SuperJMN
pushed a commit
to SuperJMN/WalletWasabi
that referenced
this issue
Apr 5, 2024
Add command to privacy bar to show UTXOs details
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: