Comments (3)
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.
from walletwasabi.
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;
}
from walletwasabi.
Done.
from walletwasabi.
Related Issues (20)
- Inappropriate use of random number generator
- Exlicit use of random generator HOT 3
- Visible list of suggested labels while textbox is empty HOT 3
- NavBar selection indicator on wrong wallet HOT 1
- [VDG] Coinjoin transaction group gets collapsed by itself HOT 3
- Many transaction notifications when opening a wallet. HOT 4
- [VDG] CurrencyEntryBox is not consistent HOT 1
- [VDG] ListBox hidden selected item bug HOT 1
- TXDetails: CopyableContent of address
- Removing Alices who have already spent their inputs doesn't work
- Shortened output registration or signing phase disrupts round HOT 5
- GUI frozen after minimizing HOT 6
- Don't test more than MinGapLimit clean keys during resync
- [VDG] Self transfer Preview Transaction and Transaction Details issues
- `FailFastTransactionSigningTimeout` is too short HOT 4
- `OutputRegistrationTimeout` and `TransactionSigningTimeout` in status are misleading HOT 2
- TOR takes long time to recover HOT 2
- [VDG] Destination addresses for incoming transactions HOT 3
- Wallet wrongly relies on `OutputRegistationTimeout` and `TransactionSigningTimeout`
- Wallet Coins: single click acts as double click in SelectionCheckBox
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from walletwasabi.