geforkt von Mirrors/Paper
Only create paper.yml-README.txt on config conversion (#8334)
Dieser Commit ist enthalten in:
Ursprung
88d5b59398
Commit
1fc4118bd8
@ -1234,12 +1234,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
||||
+ final Path legacy = Files.isSymbolicLink(legacyConfig) ? Files.readSymbolicLink(legacyConfig) : legacyConfig;
|
||||
+ final Path replacementFile = legacy.resolveSibling(legacyConfig.getFileName() + "-README.txt");
|
||||
+ if (Files.notExists(replacementFile)) {
|
||||
+ Files.createFile(replacementFile);
|
||||
+ Files.writeString(replacementFile, String.format(MOVED_NOTICE, configDir.toAbsolutePath()));
|
||||
+ }
|
||||
+ if (needsConverting(legacyConfig)) {
|
||||
+ final String legacyFileName = legacyConfig.getFileName().toString();
|
||||
+ try {
|
||||
+ if (Files.exists(configDir) && !Files.isDirectory(configDir)) {
|
||||
+ throw new RuntimeException("Paper needs to create a '" + CONFIG_DIR + "' folder in the root of your server. You already have a non-directory named '" + CONFIG_DIR + "'. Please remove it and restart the server.");
|
||||
@ -1249,7 +1245,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ throw new RuntimeException("Paper needs to create a '" + BACKUP_DIR + "' directory in the '" + CONFIG_DIR + "' folder. You already have a non-directory named '" + BACKUP_DIR + "'. Please remove it and restart the server.");
|
||||
+ }
|
||||
+ createDirectoriesSymlinkAware(backupDir);
|
||||
+ final String backupFileName = legacyConfig.getFileName().toString() + ".old";
|
||||
+ final String backupFileName = legacyFileName + ".old";
|
||||
+ final Path legacyConfigBackup = backupDir.resolve(backupFileName);
|
||||
+ if (Files.exists(legacyConfigBackup) && !Files.isRegularFile(legacyConfigBackup)) {
|
||||
+ throw new RuntimeException("Paper needs to create a '" + backupFileName + "' file in the '" + BACKUP_DIR + "' folder. You already have a non-file named '" + backupFileName + "'. Please remove it and restart the server.");
|
||||
@ -1258,9 +1254,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (Files.isSymbolicLink(legacyConfig)) {
|
||||
+ Files.delete(legacyConfig);
|
||||
+ }
|
||||
+ final Path replacementFile = legacy.resolveSibling(legacyFileName + "-README.txt");
|
||||
+ if (Files.notExists(replacementFile)) {
|
||||
+ Files.createFile(replacementFile);
|
||||
+ Files.writeString(replacementFile, String.format(MOVED_NOTICE, configDir.toAbsolutePath()));
|
||||
+ }
|
||||
+ convert(legacyConfigBackup, configDir, worldFolder, spigotConfig);
|
||||
+ } catch (final IOException ex) {
|
||||
+ throw new RuntimeException("Could not convert '" + legacyConfig.getFileName().toString() + "' to the new configuration format", ex);
|
||||
+ throw new RuntimeException("Could not convert '" + legacyFileName + "' to the new configuration format", ex);
|
||||
+ }
|
||||
+ }
|
||||
+ try {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren