3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-17 00:20:09 +01:00

fix: correctly resolve file if extension is given (#2857)

* fix: correctly resolve file if extension is given

* Adjust error if ClipboardFormats#findByFile null
Dieser Commit ist enthalten in:
Jordan 2024-07-31 21:08:06 +02:00 committet von GitHub
Ursprung 638344d815
Commit f93ad596c6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
3 geänderte Dateien mit 11 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -712,6 +712,12 @@ public class MainUtil {
return file; return file;
} }
} }
if (filename.matches(".*\\.[\\w].*")) {
File file = MainUtil.resolveRelative(new File(dir, filename));
if (file.exists()) {
return file;
}
}
for (ClipboardFormat f : ClipboardFormats.getAll()) { for (ClipboardFormat f : ClipboardFormats.getAll()) {
File file = MainUtil.resolveRelative(new File(dir, filename + "." + f.getPrimaryFileExtension())); File file = MainUtil.resolveRelative(new File(dir, filename + "." + f.getPrimaryFileExtension()));
if (file.exists()) { if (file.exists()) {

Datei anzeigen

@ -401,7 +401,11 @@ public class SchematicCommands {
if (format == null) { if (format == null) {
format = ClipboardFormats.findByFile(file); format = ClipboardFormats.findByFile(file);
if (format == null) { if (format == null) {
if (noExplicitFormat) {
actor.print(Caption.of("fawe.worldedit.schematic.schematic.load-failure", TextComponent.of(file.getName())));
} else {
actor.print(Caption.of("worldedit.schematic.unknown-format", TextComponent.of(formatName))); actor.print(Caption.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
}
return; return;
} }
} }

Datei anzeigen

@ -208,7 +208,6 @@ public class ClipboardFormats {
} }
} }
return null; return null;
} }
public static MultiClipboardHolder loadAllFromInput( public static MultiClipboardHolder loadAllFromInput(