yarn/mappings/net/minecraft/util/PathUtil.mapping

70 lines
3.6 KiB
Plaintext

CLASS net/minecraft/class_4239 net/minecraft/util/PathUtil
COMMENT A class holding path-related utility methods.
FIELD field_18955 RESERVED_WINDOWS_NAMES Ljava/util/regex/Pattern;
FIELD field_18956 FILE_NAME_WITH_COUNT Ljava/util/regex/Pattern;
FIELD field_33384 MAX_NAME_LENGTH I
FIELD field_40712 VALID_FILE_NAME Ljava/util/regex/Pattern;
METHOD method_19773 getNextUniqueName (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
COMMENT {@return a filename, prefixed with {@code name}, that does not currently
COMMENT exist inside {@code path}}
COMMENT
COMMENT @implNote This strips any illegal characters from {@code name}, then
COMMENT attempts to make a directory with the name and the extension. If this succeeds,
COMMENT the directory is deleted and the name with the extension is returned. If not, it
COMMENT appends {@code (1)} to the name and tries again until it succeeds.
COMMENT
COMMENT @throws IOException if creating the temporary directory fails, e.g. due to {@code path}
COMMENT not being a directory
ARG 0 path
ARG 1 name
ARG 2 extension
METHOD method_20200 isNormal (Ljava/nio/file/Path;)Z
COMMENT {@return whether {@code path} is already normalized}
ARG 0 path
METHOD method_20201 isAllowedName (Ljava/nio/file/Path;)Z
COMMENT {@return whether {@code path} does not contain reserved Windows file names}
COMMENT
COMMENT @apiNote This returns {@code false} for reserved names regardless of whether the platform
COMMENT the game is running is actually Windows. Note that this does not check for
COMMENT illegal characters or file permissions.
ARG 0 path
METHOD method_20202 getResourcePath (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/nio/file/Path;
ARG 0 path
ARG 1 resourceName
ARG 2 extension
METHOD method_34675 getPosixFullPath (Ljava/lang/String;)Ljava/lang/String;
COMMENT {@return the full path of {@code path} with directory separator normalized
COMMENT to {@code /}}
ARG 0 path
METHOD method_34676 normalizeToPosix (Ljava/lang/String;)Ljava/lang/String;
COMMENT {@return the normalized path of {@code path} with directory separator normalized
COMMENT to {@code /}}
ARG 0 path
METHOD method_46344 getPath (Ljava/nio/file/Path;Ljava/util/List;)Ljava/nio/file/Path;
COMMENT {@return {@code paths} resolved as a path from {@code root}}
COMMENT
COMMENT <p>If {@code paths} is empty, this returns {@code root}.
ARG 0 root
ARG 1 paths
METHOD method_46345 validatePath ([Ljava/lang/String;)V
COMMENT Validates that {@code paths} is not empty and does not contain invalid segments
COMMENT (such as {@code .}, {@code ..}, or otherwise {@linkplain #isFileNameValid invalid names}).
COMMENT
COMMENT @throws IllegalArgumentException when the {@code paths} are invalid
ARG 0 paths
METHOD method_46346 split (Ljava/lang/String;)Lcom/mojang/serialization/DataResult;
COMMENT {@return {@code path} split by {@code /}, or an error result if the path is invalid}
COMMENT
COMMENT <p>All path segments must be a {@linkplain #isFileNameValid valid file name}. Additionally,
COMMENT {@code .} and {@code ..} are forbidden.
ARG 0 path
METHOD method_46347 isFileNameValid (Ljava/lang/String;)Z
COMMENT {@return whether {@code name} is a valid file name}
COMMENT
COMMENT @apiNote A valid file name contains only ASCII lowercase alphabets, ASCII digits,
COMMENT a dot, or an underscore. Unlike {@link Identifier} paths, hyphens are not allowed.
ARG 0 name
METHOD method_47525 createDirectories (Ljava/nio/file/Path;)V
COMMENT A symbolic-link safe version of {@link java.nio.file.Files#createDirectories}.
ARG 0 path