From 2fb74dc552ea5fd365735b8bc8b6826a7987f891 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sat, 11 May 2024 15:18:41 +0300 Subject: [PATCH] fix xdg-open permissions on Linux --- img-ui/build.gradle.kts | 5 +++-- .../unixExecutableScriptTemplate.txt | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 img-ui/src/main/resources/unixExecutableScriptTemplate.txt diff --git a/img-ui/build.gradle.kts b/img-ui/build.gradle.kts index 048b5f7..e91f488 100644 --- a/img-ui/build.gradle.kts +++ b/img-ui/build.gradle.kts @@ -1,4 +1,3 @@ - plugins { id("java") id("application") @@ -57,9 +56,11 @@ tasks.test { } jlink { - imageZip = project.file("${layout.buildDirectory}/distributions/ImageTagger-${javafx.platform.classifier}.zip") + val buildDirectory = layout.buildDirectory.asFile.get().absolutePath + imageZip = project.file("$buildDirectory/distributions/ImageTagger-${javafx.platform.classifier}.zip") options = listOf("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages") launcher { + unixScriptTemplate = project.file("${layout.projectDirectory}/src/main/resources/unixExecutableScriptTemplate.txt") name = "ImageTagger" } } diff --git a/img-ui/src/main/resources/unixExecutableScriptTemplate.txt b/img-ui/src/main/resources/unixExecutableScriptTemplate.txt new file mode 100644 index 0000000..be86e29 --- /dev/null +++ b/img-ui/src/main/resources/unixExecutableScriptTemplate.txt @@ -0,0 +1,21 @@ +#!/bin/sh + +# NucuLabs.dev's Image Tagger Application +SCRIPT_NAME=\$(basename "\$0") +APP_NAME=\${SCRIPT_NAME%.sh} + +DIR="\${0%/*}" + +<% if ( System.properties['BADASS_CDS_ARCHIVE_FILE_LINUX'] ) { %> +CDS_ARCHIVE_FILE="<%= System.properties['BADASS_CDS_ARCHIVE_FILE_LINUX'] %>" +CDS_JVM_OPTS="-XX:ArchiveClassesAtExit=\$CDS_ARCHIVE_FILE" +if [ -f "\$CDS_ARCHIVE_FILE" ]; then + CDS_JVM_OPTS="-XX:SharedArchiveFile=\$CDS_ARCHIVE_FILE" +fi +<% } %> + +# Make jexec and jspawnhelper executable otherwise they won't work properly. +chmod +x \$DIR/../lib/jexec +chmod +x \$DIR/../lib/jspawnhelper + +"\$DIR/java" \$CDS_JVM_OPTS ${jvmArgs} -p "\$DIR/../app" -m ${moduleName}/${mainClassName} ${args} "\$@" \ No newline at end of file