Skip to content

Commit 5974de4

Browse files
committed
use Path#relativize instead
1 parent adad0e8 commit 5974de4

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,7 @@ public Component getComponent(int number) {
494494

495495
String path = inRoot
496496
? file.getFileName().toString()
497-
: file.toString().substring(rootDir.toString().length());
498-
499-
if (path.startsWith(File.separator)) {
500-
// Remove leading separator from the path if present, the load command fails otherwise
501-
path = path.substring(1);
502-
}
497+
: rootDir.relativize(file).toString();
503498

504499
return TextComponent.builder()
505500
.content("")

0 commit comments

Comments
 (0)