Skip to content

Commit

Permalink
fix #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Deficuet committed Jun 2, 2024
1 parent 25650e6 commit e3bb601
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

def progVersion = "1.0.1"
def progVersion = "1.0.2"
group 'io.github.deficuet'
version progVersion
mainClassName = "io.github.deficuet.alpa.MainApp"
Expand Down
16 changes: 7 additions & 9 deletions src/main/kotlin/io/github/deficuet/alpa/Functions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ class Functions(private val gui: MainView): Closeable {
FileChooser.ExtensionFilter("Required Files ($wct)", wct),
FileChooser.ExtensionFilter("All Files (*.*)", "*.*")
),
File(configurations.face.importBundlePath).withDefaultPath(
Path(configurations.assetSystemRoot).resolve("paintingface").pathString
)
File(configurations.face.importBundlePath)
.withDefaultPath(Path(configurations.assetSystemRoot).resolve("paintingface").pathString)
.withDefaultPath()
)
if (files.isEmpty()) return null
gui.errorString.value = ""
Expand Down Expand Up @@ -799,9 +799,7 @@ class Functions(private val gui: MainView): Closeable {
fun importAssetSystemRoot(): File? {
val folder = chooseDirectory(
"选择文件夹",
configurations.assetSystemRoot.let {
File(it).withDefaultPath()
}
File(configurations.assetSystemRoot).withDefaultPath()
) ?: return null
configurations.assetSystemRoot = folder.absolutePath
return folder
Expand All @@ -810,9 +808,9 @@ class Functions(private val gui: MainView): Closeable {
fun importMainFile(): File? {
val files = chooseFile(
"选择文件", allTypeFilter,
File(configurations.importMainBundlePath).withDefaultPath(
Path(configurations.assetSystemRoot).resolve("painting").pathString
)
File(configurations.importMainBundlePath)
.withDefaultPath(Path(configurations.assetSystemRoot).resolve("painting").pathString)
.withDefaultPath()
)
if (files.isEmpty()) return null
val file = files[0]
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/github/deficuet/alpa/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import kotlin.io.path.Path
import javafx.scene.paint.Color as ColorFX

fun File.withDefaultPath(defaultPath: String = "C:/Users"): File {
return if (exists()) this else File(defaultPath)
return if (exists() && isDirectory) this else File(defaultPath)
}

fun generateFileName(raw: String): String {
Expand Down

0 comments on commit e3bb601

Please sign in to comment.