mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 12:26:45 +00:00
avoid adding testnet symlink in windows as admin privileges are required
This commit is contained in:
parent
d420c71673
commit
f6ff92865b
1 changed files with 10 additions and 6 deletions
|
@ -534,7 +534,7 @@ public class Storage {
|
|||
File networkNameDir = new File(getSparrowHome(), network.getName());
|
||||
if(networkNameDir.exists() && networkNameDir.isDirectory() && !Files.isSymbolicLink(networkNameDir.toPath())) {
|
||||
try {
|
||||
if(networkNameDir.renameTo(sparrowDir)) {
|
||||
if(networkNameDir.renameTo(sparrowDir) && !isWindows()) {
|
||||
Files.createSymbolicLink(networkNameDir.toPath(), Path.of(sparrowDir.getName()));
|
||||
}
|
||||
} catch(Exception e) {
|
||||
|
@ -550,7 +550,7 @@ public class Storage {
|
|||
createOwnerOnlyDirectory(sparrowDir);
|
||||
}
|
||||
|
||||
if(!network.getName().equals(network.getHome())) {
|
||||
if(!network.getName().equals(network.getHome()) && !isWindows()) {
|
||||
try {
|
||||
Path networkNamePath = getSparrowHome().toPath().resolve(network.getName());
|
||||
if(Files.isSymbolicLink(networkNamePath)) {
|
||||
|
@ -579,7 +579,7 @@ public class Storage {
|
|||
return new File(System.getProperty(SparrowWallet.APP_HOME_PROPERTY));
|
||||
}
|
||||
|
||||
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||
if(isWindows()) {
|
||||
return new File(getHomeDir(), WINDOWS_SPARROW_DIR);
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ public class Storage {
|
|||
}
|
||||
|
||||
static File getHomeDir() {
|
||||
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||
if(isWindows()) {
|
||||
return new File(System.getenv("APPDATA"));
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ public class Storage {
|
|||
|
||||
public static boolean createOwnerOnlyDirectory(File directory) {
|
||||
try {
|
||||
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||
if(isWindows()) {
|
||||
Files.createDirectories(directory.toPath());
|
||||
return true;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ public class Storage {
|
|||
|
||||
public static boolean createOwnerOnlyFile(File file) {
|
||||
try {
|
||||
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||
if(isWindows()) {
|
||||
Files.createFile(file.toPath());
|
||||
return true;
|
||||
}
|
||||
|
@ -645,6 +645,10 @@ public class Storage {
|
|||
return ownerOnly;
|
||||
}
|
||||
|
||||
private static boolean isWindows() {
|
||||
return Platform.getCurrent() == Platform.WINDOWS;
|
||||
}
|
||||
|
||||
public static class LoadWalletService extends Service<WalletAndKey> {
|
||||
private final Storage storage;
|
||||
private final SecureString password;
|
||||
|
|
Loading…
Reference in a new issue