mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
platform specific changes
This commit is contained in:
parent
350bddac84
commit
f8d15f73f6
10 changed files with 39 additions and 9 deletions
4
.github/workflows/package-osx.yaml
vendored
4
.github/workflows/package-osx.yaml
vendored
|
@ -13,8 +13,8 @@ jobs:
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 14.0.2
|
java-version: 14.0.2
|
||||||
- name: Show Java Version
|
- name: Show Build Versions
|
||||||
run: java -version
|
run: ./gradlew -v
|
||||||
- name: Cache Gradle packages
|
- name: Cache Gradle packages
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
|
22
build.gradle
22
build.gradle
|
@ -6,6 +6,11 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
def sparrowVersion = '0.9.1'
|
def sparrowVersion = '0.9.1'
|
||||||
|
def os = org.gradle.internal.os.OperatingSystem.current()
|
||||||
|
def osName = os.getFamilyName()
|
||||||
|
if(os.macOsX) {
|
||||||
|
osName = "mac"
|
||||||
|
}
|
||||||
|
|
||||||
group "com.sparrowwallet"
|
group "com.sparrowwallet"
|
||||||
version "${sparrowVersion}"
|
version "${sparrowVersion}"
|
||||||
|
@ -71,6 +76,14 @@ compileJava {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
doLast {
|
||||||
|
delete fileTree("$buildDir/resources/main/external").matching {
|
||||||
|
exclude "$osName/**"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
run {
|
run {
|
||||||
applicationDefaultJvmArgs = ["-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow.png",
|
applicationDefaultJvmArgs = ["-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow.png",
|
||||||
"--add-opens=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
|
"--add-opens=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
|
||||||
|
@ -129,12 +142,13 @@ jlink {
|
||||||
installerOptions = [
|
installerOptions = [
|
||||||
'--file-associations', 'src/main/resources/associations.properties',
|
'--file-associations', 'src/main/resources/associations.properties',
|
||||||
]
|
]
|
||||||
if (org.gradle.internal.os.OperatingSystem.current().windows) {
|
if(os.windows) {
|
||||||
installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu']
|
installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu', '--win-shortcut']
|
||||||
|
imageOptions += ['--icon', 'src/main/deploy/package/windows/sparrow.ico']
|
||||||
}
|
}
|
||||||
if (org.gradle.internal.os.OperatingSystem.current().macOsX) {
|
if(os.macOsX) {
|
||||||
installerOptions += ['--mac-sign', '--mac-signing-key-user-name', 'Craig Raw (UPLVMSK9D7)']
|
installerOptions += ['--mac-sign', '--mac-signing-key-user-name', 'Craig Raw (UPLVMSK9D7)']
|
||||||
imageOptions += ['--icon', 'src/main/deploy/package/macosx/sparrow.icns', '--resource-dir', 'src/main/deploy/package/macosx/']
|
imageOptions += ['--icon', 'src/main/deploy/package/mac/sparrow.icns', '--resource-dir', 'src/main/deploy/package/mac/']
|
||||||
installerType = "dmg"
|
installerType = "dmg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
src/main/deploy/package/windows/sparrow.ico
Normal file
BIN
src/main/deploy/package/windows/sparrow.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
|
@ -182,8 +182,8 @@ public class Hwi {
|
||||||
//To avoid doing these with every invocation, use a --onedir packaging and expand into a temp folder on OSX
|
//To avoid doing these with every invocation, use a --onedir packaging and expand into a temp folder on OSX
|
||||||
//The check will still happen on first invocation, but will not thereafter
|
//The check will still happen on first invocation, but will not thereafter
|
||||||
//See https://github.com/bitcoin-core/HWI/issues/327 for details
|
//See https://github.com/bitcoin-core/HWI/issues/327 for details
|
||||||
if(platform.getPlatformId().toLowerCase().equals("mac")) {
|
if(platform == Platform.OSX) {
|
||||||
InputStream inputStream = Hwi.class.getResourceAsStream("/external/" + platform.getPlatformId().toLowerCase() + "/hwi-1.1.2-mac-amd64-signed.zip");
|
InputStream inputStream = Hwi.class.getResourceAsStream("/external/mac/hwi-1.1.2-mac-amd64-signed.zip");
|
||||||
Path tempHwiDirPath = Files.createTempDirectory(TEMP_FILE_PREFIX, PosixFilePermissions.asFileAttribute(ownerExecutableWritable));
|
Path tempHwiDirPath = Files.createTempDirectory(TEMP_FILE_PREFIX, PosixFilePermissions.asFileAttribute(ownerExecutableWritable));
|
||||||
File tempHwiDir = tempHwiDirPath.toFile();
|
File tempHwiDir = tempHwiDirPath.toFile();
|
||||||
//tempHwiDir.deleteOnExit();
|
//tempHwiDir.deleteOnExit();
|
||||||
|
@ -211,7 +211,13 @@ public class Hwi {
|
||||||
|
|
||||||
hwiExecutable = tempExec;
|
hwiExecutable = tempExec;
|
||||||
} else {
|
} else {
|
||||||
InputStream inputStream = Hwi.class.getResourceAsStream("/external/" + platform.getPlatformId().toLowerCase() + "/hwi");
|
InputStream inputStream;
|
||||||
|
if(platform == Platform.WINDOWS) {
|
||||||
|
inputStream = Hwi.class.getResourceAsStream("/external/windows/hwi.exe");
|
||||||
|
} else {
|
||||||
|
inputStream = Hwi.class.getResourceAsStream("/external/" + platform.getPlatformId().toLowerCase() + "/hwi");
|
||||||
|
}
|
||||||
|
|
||||||
Path tempExecPath = Files.createTempFile(TEMP_FILE_PREFIX, null, PosixFilePermissions.asFileAttribute(ownerExecutableWritable));
|
Path tempExecPath = Files.createTempFile(TEMP_FILE_PREFIX, null, PosixFilePermissions.asFileAttribute(ownerExecutableWritable));
|
||||||
File tempExec = tempExecPath.toFile();
|
File tempExec = tempExecPath.toFile();
|
||||||
//tempExec.deleteOnExit();
|
//tempExec.deleteOnExit();
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
import com.sparrowwallet.drongo.wallet.WalletNode;
|
import com.sparrowwallet.drongo.wallet.WalletNode;
|
||||||
import javafx.concurrent.Service;
|
import javafx.concurrent.Service;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
|
import org.controlsfx.tools.Platform;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
@ -33,6 +34,7 @@ public class Storage {
|
||||||
private static final DateFormat BACKUP_DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");
|
private static final DateFormat BACKUP_DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
|
||||||
public static final String SPARROW_DIR = ".sparrow";
|
public static final String SPARROW_DIR = ".sparrow";
|
||||||
|
public static final String WINDOWS_SPARROW_DIR = "Sparrow";
|
||||||
public static final String WALLETS_DIR = "wallets";
|
public static final String WALLETS_DIR = "wallets";
|
||||||
public static final String WALLETS_BACKUP_DIR = "backup";
|
public static final String WALLETS_BACKUP_DIR = "backup";
|
||||||
public static final String HEADER_MAGIC_1 = "SPRW1";
|
public static final String HEADER_MAGIC_1 = "SPRW1";
|
||||||
|
@ -269,10 +271,18 @@ public class Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
static File getSparrowDir() {
|
static File getSparrowDir() {
|
||||||
|
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||||
|
return new File(getHomeDir(), WINDOWS_SPARROW_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
return new File(getHomeDir(), SPARROW_DIR);
|
return new File(getHomeDir(), SPARROW_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static File getHomeDir() {
|
static File getHomeDir() {
|
||||||
|
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||||
|
return new File(System.getenv("APPDATA"));
|
||||||
|
}
|
||||||
|
|
||||||
return new File(System.getProperty("user.home"));
|
return new File(System.getProperty("user.home"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
src/main/resources/external/linux/hwi
vendored
Executable file
BIN
src/main/resources/external/linux/hwi
vendored
Executable file
Binary file not shown.
BIN
src/main/resources/external/windows/hwi.exe
vendored
Executable file
BIN
src/main/resources/external/windows/hwi.exe
vendored
Executable file
Binary file not shown.
Loading…
Reference in a new issue