Package net.minecraft.util
Class FileNameUtil
java.lang.Object
net.minecraft.util.FileNameUtil
A class holding file name-related utility methods.
- Mappings:
Namespace Name official xintermediary net/minecraft/class_4239named net/minecraft/util/FileNameUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetNextUniqueName(Path path, String name, String extension) Returns a filename, prefixed withname, that does not currently exist insidepath.static StringgetPosixFullPath(String path) Returns the full path ofpathwith directory separator normalized to/.static PathgetResourcePath(Path path, String resourceName, String extension) static booleanisAllowedName(Path path) Returns whetherpathdoes not contain reserved Windows file names.static booleanReturns whetherpathis already normalized.static StringnormalizeToPosix(String path) Returns the normalized path ofpathwith directory separator normalized to/.
-
Field Details
-
FILE_NAME_WITH_COUNT
- Mappings:
Namespace Name Mixin selector official aLx;a:Ljava/util/regex/Pattern;intermediary field_18956Lnet/minecraft/class_4239;field_18956:Ljava/util/regex/Pattern;named FILE_NAME_WITH_COUNTLnet/minecraft/util/FileNameUtil;FILE_NAME_WITH_COUNT:Ljava/util/regex/Pattern;
-
MAX_NAME_LENGTH
private static final int MAX_NAME_LENGTH- See Also:
- Mappings:
Namespace Name Mixin selector official bLx;b:Iintermediary field_33384Lnet/minecraft/class_4239;field_33384:Inamed MAX_NAME_LENGTHLnet/minecraft/util/FileNameUtil;MAX_NAME_LENGTH:I
-
RESERVED_WINDOWS_NAMES
- Mappings:
Namespace Name Mixin selector official cLx;c:Ljava/util/regex/Pattern;intermediary field_18955Lnet/minecraft/class_4239;field_18955:Ljava/util/regex/Pattern;named RESERVED_WINDOWS_NAMESLnet/minecraft/util/FileNameUtil;RESERVED_WINDOWS_NAMES:Ljava/util/regex/Pattern;
-
-
Constructor Details
-
FileNameUtil
public FileNameUtil()
-
-
Method Details
-
getNextUniqueName
Returns a filename, prefixed withname, that does not currently exist insidepath.- Returns:
- a filename, prefixed with
name, that does not currently exist insidepath - Throws:
IOException- if creating the temporary directory fails, e.g. due topathnot being a directory- Implementation Note:
- This strips any illegal characters from
name, then attempts to make a directory with the name and the extension. If this succeeds, the directory is deleted and the name with the extension is returned. If not, it appends(1)to the name and tries again until it succeeds. - Mappings:
Namespace Name Mixin selector official aLx;a(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;intermediary method_19773Lnet/minecraft/class_4239;method_19773(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;named getNextUniqueNameLnet/minecraft/util/FileNameUtil;getNextUniqueName(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
-
isNormal
Returns whetherpathis already normalized.- Returns:
- whether
pathis already normalized - Mappings:
Namespace Name Mixin selector official aLx;a(Ljava/nio/file/Path;)Zintermediary method_20200Lnet/minecraft/class_4239;method_20200(Ljava/nio/file/Path;)Znamed isNormalLnet/minecraft/util/FileNameUtil;isNormal(Ljava/nio/file/Path;)Z
-
isAllowedName
Returns whetherpathdoes not contain reserved Windows file names.- Returns:
- whether
pathdoes not contain reserved Windows file names - API Note:
- This returns
falsefor reserved names regardless of whether the platform the game is running is actually Windows. Note that this does not check for illegal characters or file permissions. - Mappings:
Namespace Name Mixin selector official bLx;b(Ljava/nio/file/Path;)Zintermediary method_20201Lnet/minecraft/class_4239;method_20201(Ljava/nio/file/Path;)Znamed isAllowedNameLnet/minecraft/util/FileNameUtil;isAllowedName(Ljava/nio/file/Path;)Z
-
getResourcePath
- Mappings:
Namespace Name Mixin selector official bLx;b(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/nio/file/Path;intermediary method_20202Lnet/minecraft/class_4239;method_20202(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/nio/file/Path;named getResourcePathLnet/minecraft/util/FileNameUtil;getResourcePath(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;)Ljava/nio/file/Path;
-
getPosixFullPath
Returns the full path ofpathwith directory separator normalized to/.- Returns:
- the full path of
pathwith directory separator normalized to/ - Mappings:
Namespace Name Mixin selector official aLx;a(Ljava/lang/String;)Ljava/lang/String;intermediary method_34675Lnet/minecraft/class_4239;method_34675(Ljava/lang/String;)Ljava/lang/String;named getPosixFullPathLnet/minecraft/util/FileNameUtil;getPosixFullPath(Ljava/lang/String;)Ljava/lang/String;
-
normalizeToPosix
Returns the normalized path ofpathwith directory separator normalized to/.- Returns:
- the normalized path of
pathwith directory separator normalized to/ - Mappings:
Namespace Name Mixin selector official bLx;b(Ljava/lang/String;)Ljava/lang/String;intermediary method_34676Lnet/minecraft/class_4239;method_34676(Ljava/lang/String;)Ljava/lang/String;named normalizeToPosixLnet/minecraft/util/FileNameUtil;normalizeToPosix(Ljava/lang/String;)Ljava/lang/String;
-