Fix file tab completion in production environments
This commit is contained in:
parent
90fb17b89f
commit
84f45ebb48
@ -11,6 +11,8 @@ import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public class RelativeFile implements IDatatypePost<File, File> {
|
||||
private final Path path;
|
||||
|
||||
@ -48,4 +50,14 @@ public class RelativeFile implements IDatatypePost<File, File> {
|
||||
public File apply(File original) {
|
||||
return original.toPath().resolve(path).toFile();
|
||||
}
|
||||
|
||||
public static File gameDir() {
|
||||
File gameDir = HELPER.mc.gameDir.getAbsoluteFile();
|
||||
|
||||
if (gameDir.getName().equals(".")) {
|
||||
return gameDir.getParentFile();
|
||||
}
|
||||
|
||||
return gameDir;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class ExploreFilterCommand extends Command {
|
||||
@Override
|
||||
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
|
||||
if (args.hasExactlyOne()) {
|
||||
return RelativeFile.tabComplete(args, MC.gameDir.getAbsoluteFile().getParentFile());
|
||||
return RelativeFile.tabComplete(args, RelativeFile.gameDir());
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user