diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml deleted file mode 100644 index b0a8883..0000000 --- a/.idea/dataSources.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - sqlite.xerial - true - org.sqlite.JDBC - jdbc:sqlite:$USER_HOME$/AppData/Local/PAL/Data/PALData.db - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..8b7f4af --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d30d09e..3a6c3d2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/PoE-Addon-Launcher-Core.iml b/PoE-Addon-Launcher-Core.iml index 1808bc9..64d05d4 100644 --- a/PoE-Addon-Launcher-Core.iml +++ b/PoE-Addon-Launcher-Core.iml @@ -41,7 +41,7 @@ - + diff --git a/pom.xml b/pom.xml index 899873a..56d1e1e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ RizlimDev PoE-Addon-Launcher-Core - 1.11.4 + 1.12 1.3.0 @@ -25,6 +25,9 @@ true Launcher2 + + . + @@ -33,8 +36,12 @@ + true Launcher2 + + . + jar-with-dependencies diff --git a/src/main/kotlin/PAL2/Github/UpdateGrabber.kt b/src/main/kotlin/PAL2/Github/UpdateGrabber.kt index 642c6a5..d9517f4 100644 --- a/src/main/kotlin/PAL2/Github/UpdateGrabber.kt +++ b/src/main/kotlin/PAL2/Github/UpdateGrabber.kt @@ -4,49 +4,60 @@ import Github.connect import SystemHandling.deleteFile import SystemHandling.unzip import SystemHandling.verifyFolder +import mu.KotlinLogging import org.apache.commons.io.FileUtils import java.io.File import java.net.URL +private val logger = KotlinLogging.logger {} + /** * */ -fun getUpdate(install: String) +fun checkUpdate() +{ + if (!GlobalData.debugging) + { + val gh = connect() + if (gh.rateLimit.remaining > 3) + { + val repo = gh.getRepository("") + } + } +} + +fun getUpdate() { // Get Token from DB if DB exists and if token is != "" if (!GlobalData.debugging) { val gh = connect() - if (gh.rateLimit.remaining > 5) + if (gh.rateLimit.remaining > 3) { - val repo = gh.getRepository("POE-Addon-Launcher/PAL2") + val repo = gh.getRepository("POE-Addon-Launcher/PALRelease") val latest = repo.latestRelease val latest_tag = latest.tagName if(latest_tag != GlobalData.version) { val down_folder = File("${GlobalData.pal_folder}") - - val temp_update = File("$install${File.separator}latest") - verifyFolder(down_folder) - verifyFolder(temp_update) - val dest = File("${down_folder.path}${File.separator}pal.zip") + val dest = File("${GlobalData.install_dir}${File.separator}new${File.separator}PAL2.jar") + val destFolder = File("${GlobalData.install_dir}${File.separator}new") if (dest.exists()) - { deleteFile(dest) - } + + if (!destFolder.exists()) + destFolder.mkdir() val download_url = latest.assets[0].browserDownloadUrl FileUtils.copyURLToFile(URL(download_url), dest) - println("Unzipping: ${dest.path} in ${temp_update.path}") - unzip(dest, temp_update) + logger.debug { "Downloaded update [$latest_tag] to: $dest" } - val stateONE = File("${GlobalData.pal_folder.path}${File.separator}1.state") - stateONE.createNewFile() - // Launch the newest version instead. - Runtime.getRuntime().exec("\"$temp_update${File.separator}PAL2.exe\"") + //rundll32 url.dll,FileProtocolHandler + println(">>> \"${GlobalData.install_dir}${File.separator}PAL2.exe\" <<") + Runtime.getRuntime().exec("\"${GlobalData.install_dir}${File.separator}PAL2.exe\"") System.exit(99) } diff --git a/src/main/kotlin/PAL2/GlobalData.kt b/src/main/kotlin/PAL2/GlobalData.kt index ad8d1f6..fecec7d 100644 --- a/src/main/kotlin/PAL2/GlobalData.kt +++ b/src/main/kotlin/PAL2/GlobalData.kt @@ -10,7 +10,7 @@ class GlobalData { companion object { - var version = "1.11.4" + var version = "1.12.2" var debugging = false var install_dir = "" var github_token = "" diff --git a/src/main/kotlin/PAL2/Launcher.kt b/src/main/kotlin/PAL2/Launcher.kt index 4ec45bf..79073c0 100644 --- a/src/main/kotlin/PAL2/Launcher.kt +++ b/src/main/kotlin/PAL2/Launcher.kt @@ -22,6 +22,21 @@ class Launcher2 // Set Locale to US to avoid any locale issues. Locale.setDefault(Locale.US) + if (!GlobalData.debugging) + { + var fInstall = File(Launcher2::class.java.protectionDomain.codeSource.location.toURI()) + + if (fInstall.isFile) + { + fInstall = fInstall.parentFile + } + GlobalData.install_dir = fInstall.path + + + } + + + /* if (!GlobalData.debugging) { var fInstall = File(Launcher2::class.java.protectionDomain.codeSource.location.toURI()) @@ -52,7 +67,7 @@ class Launcher2 deleteFile(newest_update) deleteFile(stateTWO) } - } + }*/ try { diff --git a/src/main/kotlin/PAL2/SystemHandling/Init.kt b/src/main/kotlin/PAL2/SystemHandling/Init.kt index 00da18d..739bcfe 100644 --- a/src/main/kotlin/PAL2/SystemHandling/Init.kt +++ b/src/main/kotlin/PAL2/SystemHandling/Init.kt @@ -6,6 +6,7 @@ import PAL2.Database.* import PAL2.GUI.Configurator.ConfiguratorApplication import PAL2.GUI.CoreApplication import PAL2.GUI.Loader.Loader +import PAL2.Github.checkUpdate import PAL2.Github.getUpdate import PAL_DataClasses.PAL_AddonFullData import PAL_DataClasses.initObjectMapper @@ -106,7 +107,10 @@ fun moreInit() } loader("Checking for Updates to PAL", 0.5) - getUpdate(GlobalData.install_dir) + //getUpdate(GlobalData.install_dir) + + getUpdate() + loader("No updates to PAL!", 0.6) diff --git a/src/main/resources/update_notes.html b/src/main/resources/update_notes.html index 1791581..1ce7526 100644 --- a/src/main/resources/update_notes.html +++ b/src/main/resources/update_notes.html @@ -60,6 +60,13 @@ +

Version 1.12

+
    +
  • No longer uses Excelsior JET!
  • +
  • License issue won't happen anymore.
  • +
  • Readme's now use Markdown.md from their github repos.
  • +
+

Version 1.11

  • Fix some bugs with Externals
  • diff --git a/src/test/kotlin/PAL2/Github/UpdateGrabberKtTest.kt b/src/test/kotlin/PAL2/Github/UpdateGrabberKtTest.kt deleted file mode 100644 index 101eb83..0000000 --- a/src/test/kotlin/PAL2/Github/UpdateGrabberKtTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package PAL2.Github - -import org.junit.Assert.* -import org.junit.Test - -/** - * - */ -class UpdateGrabberKtTest -{ - @Test - fun getUpdateTest() - { - getUpdate("P:\\PAL_TEST_INSTALL") - } -} \ No newline at end of file