Skip to content

Commit

Permalink
Merge pull request #10 from ConnorDY/folder-per-export
Browse files Browse the repository at this point in the history
Use timestamped output directory for exports
  • Loading branch information
ConnorDY authored Jul 13, 2022
2 parents 4c90c39 + c7fd476 commit e82dabb
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 111 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ config.properties
/caches
*.log
/OBJ
/output
3 changes: 1 addition & 2 deletions src/main/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ import javafx.application.Application

fun main() {
Application.launch(JfxApplication::class.java)
// Application.launch(DockFX::class.java)
}
}
6 changes: 6 additions & 0 deletions src/main/kotlin/AppConstants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object AppConstants {
const val CACHES_DIRECTORY = "./caches"
const val OUTPUT_DIRECTORY = "./output"
const val TEXTURES_DIRECTORY_NAME = "/Textures"
const val TEXTURES_DIRECTORY = "${OUTPUT_DIRECTORY}/${TEXTURES_DIRECTORY_NAME}"
}
4 changes: 1 addition & 3 deletions src/main/kotlin/JfxApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import cache.CacheModule
import cache.loaders.LoaderModule
import com.google.inject.Guice
import com.sun.javafx.css.StyleManager
import controllers.MainController
import javafx.application.Application
import javafx.fxml.FXMLLoader
import javafx.scene.Parent
Expand All @@ -13,7 +12,6 @@ import models.ModelsModule
import controllers.worldRenderer.WorldRendererModule
import kotlin.system.exitProcess


class JfxApplication : Application() {
companion object {
val injector = Guice.createInjector(LoaderModule(), CacheModule(), ModelsModule(), WorldRendererModule())
Expand All @@ -40,4 +38,4 @@ class JfxApplication : Application() {
super.stop()
exitProcess(0)
}
}
}
5 changes: 3 additions & 2 deletions src/main/kotlin/controllers/CacheChooserController.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package controllers

import AppConstants
import JfxApplication.Companion.injector
import cache.CacheLibraryProvider
import cache.XteaManagerProvider
Expand Down Expand Up @@ -147,7 +148,7 @@ class CacheChooserController @Inject constructor(

btnChooseDirectory.setOnAction {
val directoryChooser = DirectoryChooser()
val initDir = File("./caches")
val initDir = File(AppConstants.CACHES_DIRECTORY)
initDir.mkdirs()
directoryChooser.initialDirectory = initDir
val f = directoryChooser.showDialog(null) ?: return@setOnAction
Expand Down Expand Up @@ -196,7 +197,7 @@ class CacheChooserController @Inject constructor(
lblStatusText.isVisible = true
lblStatusText.text = "Downloading cache $cacheName please wait.."
txtCacheLocation.text = ""
val destFolder = File("caches/${cacheName.removeSuffix(".tar.gz")}")
val destFolder = File("${AppConstants.CACHES_DIRECTORY}/${cacheName.removeSuffix(".tar.gz")}")

GlobalScope.launch {
try {
Expand Down
Loading

0 comments on commit e82dabb

Please sign in to comment.