8377392: jpackage: Fix member function called from the CfgFile.Referencies compact canonical constructor

Reviewed-by: liach, almatvee
This commit is contained in:
Alexey Semenyuk 2026-02-07 03:18:11 +00:00
parent 4c322344cd
commit 40bf0870f7

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -124,21 +124,19 @@ final class CfgFile {
Files.write(cfgFile, (Iterable<String>) lines::iterator);
}
private record Referencies(Path appModsDirectory) {
private record Referencies(Path appModsDirectory, Path appDirectory) {
Referencies {
if (!appModsDirectory.startsWith(appDirectory())) {
if (!appModsDirectory.startsWith(appDirectory)) {
throw new IllegalArgumentException();
}
}
Referencies(ApplicationLayout appLayout) {
this(Path.of("$APPDIR").resolve(appLayout.appModsDirectory().getFileName()));
this(BASEDIR.resolve(appLayout.appModsDirectory().getFileName()), BASEDIR);
}
Path appDirectory() {
return Path.of("$APPDIR");
}
private static final Path BASEDIR = Path.of("$APPDIR");
}
private final LauncherStartupInfo startupInfo;