File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,19 @@ tasks.register<Copy>("runServer") {
4040 val launcherRepo = " https://raw.githubusercontent.com/AllayMC/AllayLauncher/refs/heads/main/scripts"
4141 val cmdWin = " Invoke-Expression (Invoke-WebRequest -Uri \" ${launcherRepo} /install_windows.ps1\" ).Content"
4242 val cmdLinux = " wget -qO- ${launcherRepo} /install_linux.sh | bash"
43- val cwd = layout.buildDirectory.file(" run" ).get().asFile. apply { mkdirs() }
43+ val cwd = layout.buildDirectory.file(" run" ).get().asFile
4444
4545 val shadowJar = tasks.named(" shadowJar" , ShadowJar ::class ).get()
4646 from(shadowJar.archiveFile.get().asFile)
4747 into(cwd.resolve(" plugins" ).apply { mkdirs() })
4848
49+ val isDownloaded = cwd.listFiles()!! .any { it.isFile && it.nameWithoutExtension == " allay" }
4950 val isWindows = System .getProperty(" os.name" ).startsWith(" Windows" )
5051 fun launch () = exec {
5152 workingDir = cwd
52- if (isWindows) commandLine(" powershell" , " -Command" , cmdWin)
53- else commandLine(" sh" , " -c" , cmdLinux)
53+ val cmd = if (isDownloaded) " ./allay" else if (isWindows) cmdWin else cmdLinux
54+ if (isWindows) commandLine(" powershell" , " -Command" , cmd)
55+ else commandLine(" sh" , " -c" , cmd)
5456 }
5557
5658 // https://github.com/gradle/gradle/issues/18716 // kill it manually by click X...
You can’t perform that action at this time.
0 commit comments