Skip to content

Commit

Permalink
1.12.2 - Fix License issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizlim authored and Rizlim committed Jun 26, 2019
1 parent ada9ab5 commit 512e1f4
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 52 deletions.
14 changes: 0 additions & 14 deletions .idea/dataSources.xml

This file was deleted.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion PoE-Addon-Launcher-Core.iml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.atlassian.commonmark:commonmark:0.12.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9" level="project" />
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>RizlimDev</groupId>
<artifactId>PoE-Addon-Launcher-Core</artifactId>
<version>1.11.4</version>
<version>1.12</version>

<properties>
<kotlin.version>1.3.0</kotlin.version>
Expand All @@ -25,6 +25,9 @@
<addClasspath>true</addClasspath>
<mainClass>Launcher2</mainClass>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
Expand All @@ -33,8 +36,12 @@
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>Launcher2</mainClass>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down
43 changes: 27 additions & 16 deletions src/main/kotlin/PAL2/Github/UpdateGrabber.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/PAL2/GlobalData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
17 changes: 16 additions & 1 deletion src/main/kotlin/PAL2/Launcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -52,7 +67,7 @@ class Launcher2
deleteFile(newest_update)
deleteFile(stateTWO)
}
}
}*/

try
{
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/PAL2/SystemHandling/Init.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/update_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@

</style>
<body>
<div class="block_1 hline-bottom"><h1>Version 1.12</h1></div>
<ul>
<li>No longer uses Excelsior JET!</li>
<li>License issue won't happen anymore.</li>
<li>Readme's now use Markdown.md from their github repos.</li>
</ul>

<div class="block_1 hline-bottom"><h1>Version 1.11</h1></div>
<ul>
<li>Fix some bugs with Externals</li>
Expand Down
16 changes: 0 additions & 16 deletions src/test/kotlin/PAL2/Github/UpdateGrabberKtTest.kt

This file was deleted.

0 comments on commit 512e1f4

Please sign in to comment.