mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: windows inno setup
This commit is contained in:
@@ -548,6 +548,7 @@ fun packOnWindows(distributionDir: Directory, finalFilenameWithoutExtension: Str
|
||||
"/DMyAppVersion=${appVersion}",
|
||||
"/DMyOutputDir=${distributionDir.asFile.absolutePath}",
|
||||
"/DMySetupIconFile=${FileUtils.getFile(projectDir, "src", "main", "resources", "icons", "termora.ico")}",
|
||||
"/DMyWizardSmallImageFile=${FileUtils.getFile(projectDir, "src", "main", "resources", "icons", "termora_128x128.bmp")}",
|
||||
"/DMySourceDir=${FileUtils.getFile(dir, projectName).absolutePath}",
|
||||
"/F${finalFilenameWithoutExtension}",
|
||||
FileUtils.getFile(projectDir, "src", "main", "resources", "termora.iss")
|
||||
|
||||
@@ -81,14 +81,30 @@ object Application {
|
||||
|
||||
// 从启动参数取
|
||||
var baseDataDir = System.getProperty("${getName()}.base-data-dir".lowercase())
|
||||
|
||||
// 取不到从环境取
|
||||
if (StringUtils.isBlank(baseDataDir)) {
|
||||
baseDataDir = System.getenv("${getName()}_BASE_DATA_DIR".uppercase())
|
||||
}
|
||||
|
||||
var dir = File(SystemUtils.getUserHome(), ".${getName()}".lowercase())
|
||||
if (StringUtils.isNotBlank(baseDataDir)) {
|
||||
dir = File(baseDataDir)
|
||||
// Windows 并且是绿色版,那么判断所在目录是否有 data 目录
|
||||
if (SystemInfo.isWindows && getLayout() == AppLayout.Zip && StringUtils.isBlank(baseDataDir)) {
|
||||
val appPath = getAppPath()
|
||||
if (StringUtils.isNotBlank(appPath)) {
|
||||
val file = File(appPath).parentFile
|
||||
if (file.exists()) {
|
||||
val dataFile = File(file, "data")
|
||||
if (dataFile.exists()) {
|
||||
baseDataDir = dataFile.absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val dir = if (StringUtils.isNotBlank(baseDataDir)) {
|
||||
File(baseDataDir)
|
||||
} else {
|
||||
File(SystemUtils.getUserHome(), ".${getName()}".lowercase())
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.pty4j.util.PtyUtil
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.apache.commons.lang3.SystemUtils
|
||||
import org.apache.commons.lang3.math.NumberUtils
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.tinylog.configuration.Configuration
|
||||
import java.io.File
|
||||
@@ -16,6 +17,15 @@ class ApplicationInitializr {
|
||||
|
||||
fun run() {
|
||||
|
||||
// 提供一个选项,用于延迟启动,它通常是远程调试时使用
|
||||
val delay = System.getProperty("app-delay")
|
||||
if (delay.isNullOrBlank().not()) {
|
||||
val millis = NumberUtils.toLong(delay, 0)
|
||||
if (millis > 0) {
|
||||
Thread.sleep(millis)
|
||||
}
|
||||
}
|
||||
|
||||
// 依赖二进制依赖会单独在一个文件夹
|
||||
setupNativeLibraries()
|
||||
|
||||
@@ -25,7 +35,6 @@ class ApplicationInitializr {
|
||||
// 检查是否单例
|
||||
checkSingleton()
|
||||
|
||||
|
||||
if (SystemUtils.IS_OS_MAC_OSX) {
|
||||
System.setProperty("apple.awt.application.name", Application.getName())
|
||||
}
|
||||
|
||||
BIN
src/main/resources/icons/termora_128x128.bmp
Normal file
BIN
src/main/resources/icons/termora_128x128.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -38,7 +38,7 @@ SolidCompression=yes
|
||||
WizardStyle=classic
|
||||
;WizardStyle=modern
|
||||
SetupIconFile={#MySetupIconFile}
|
||||
;WizardSmallImageFile=
|
||||
WizardSmallImageFile={#MyWizardSmallImageFile}
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
Reference in New Issue
Block a user