mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-30 13:08:24 +00:00
8241713: Linux desktop shortcuts with spaces make postinst/prerm fail
Reviewed-by: almatvee, herrick
This commit is contained in:
parent
c1016d5de2
commit
3aa216ecdf
@ -84,19 +84,21 @@ final class DesktopIntegration {
|
||||
.setCategory(I18N.getString("resource.menu-shortcut-descriptor"))
|
||||
.setPublicName(APP_NAME.fetchFrom(params) + ".desktop");
|
||||
|
||||
final String escapedAppFileName = APP_NAME.fetchFrom(params).replaceAll("\\s+", "_");
|
||||
|
||||
// XDG recommends to use vendor prefix in desktop file names as xdg
|
||||
// commands copy files to system directories.
|
||||
// Package name should be a good prefix.
|
||||
final String desktopFileName = String.format("%s-%s.desktop",
|
||||
thePackage.name(), APP_NAME.fetchFrom(params));
|
||||
thePackage.name(), escapedAppFileName);
|
||||
final String mimeInfoFileName = String.format("%s-%s-MimeInfo.xml",
|
||||
thePackage.name(), APP_NAME.fetchFrom(params));
|
||||
thePackage.name(), escapedAppFileName);
|
||||
|
||||
mimeInfoFile = new DesktopFile(mimeInfoFileName);
|
||||
|
||||
if (withDesktopFile) {
|
||||
desktopFile = new DesktopFile(desktopFileName);
|
||||
iconFile = new DesktopFile(APP_NAME.fetchFrom(params)
|
||||
iconFile = new DesktopFile(escapedAppFileName
|
||||
+ IOUtils.getSuffix(Path.of(DEFAULT_ICON)));
|
||||
|
||||
if (curIconResource == null) {
|
||||
|
||||
@ -50,7 +50,7 @@ public class LinuxHelper {
|
||||
cmd.verifyIsOfType(PackageType.LINUX);
|
||||
String desktopFileName = String.format("%s-%s.desktop", getPackageName(
|
||||
cmd), Optional.ofNullable(launcherName).orElseGet(
|
||||
() -> cmd.name()));
|
||||
() -> cmd.name()).replaceAll("\\s+", "_"));
|
||||
return cmd.appLayout().destktopIntegrationDirectory().resolve(
|
||||
desktopFileName);
|
||||
}
|
||||
|
||||
@ -91,8 +91,16 @@ public class ShortcutHintTest {
|
||||
return new PackageTest()
|
||||
.forTypes(PackageType.LINUX)
|
||||
.configureHelloApp()
|
||||
.addBundleDesktopIntegrationVerifier(true);
|
||||
|
||||
.addBundleDesktopIntegrationVerifier(true)
|
||||
.addInitializer(cmd -> {
|
||||
String defaultAppName = cmd.name();
|
||||
String appName = defaultAppName.replace(
|
||||
ShortcutHintTest.class.getSimpleName(),
|
||||
"Shortcut Hint Test");
|
||||
cmd.setArgumentValue("--name", appName);
|
||||
cmd.addArguments("--linux-package-name",
|
||||
defaultAppName.toLowerCase());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,9 +171,7 @@ public class ShortcutHintTest {
|
||||
));
|
||||
})
|
||||
.addInstallVerifier(cmd -> {
|
||||
Path desktopFile = cmd.appLayout().destktopIntegrationDirectory().resolve(
|
||||
String.format("%s-%s.desktop",
|
||||
LinuxHelper.getPackageName(cmd), cmd.name()));
|
||||
Path desktopFile = LinuxHelper.getDesktopFile(cmd);
|
||||
TKit.assertFileExists(desktopFile);
|
||||
TKit.assertTextStream(expectedVersionString)
|
||||
.label(String.format("[%s] file", desktopFile))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user