Documentation ¶
Overview ¶
Package msdos provides functions for working with MS-DOS FAT 12/16 file system filenames.
Index ¶
Constants ¶
const ( // ExtensionLen is the maximum length of a filename extension on a FAT 12/16 file system including the dot. ExtensionLen = 4 // BaseLen is the maximum length of a filename without the extension on a FAT 12/16 file system. BaseLen = 8 )
Variables ¶
This section is empty.
Functions ¶
func DirName ¶
DirName returns a FAT 16 compatible string based on the provided named directory. It uses the Rename function to convert the directory name into a FAT 16 compatible format and trims the result to the maximum length of 8 characters. Directories can have an optional extension of up to 3 characters long.
func Rename ¶
Rename returns a FAT 16 compatible string based on the provided filename. It replaces accented characters with their closest Latin equivalent and all other unsupported characters with an 'X'. The resulting filename has all spaces replaced with underscores and letters returned as uppercase. Any provided filename extension can up to 3 characters long.
Many legacy archive formats such as ZIP and LHA were usable on multiple operating systems and file systems. These archives can contain filenames that can be listed by PKZIP or LHA on an MS-DOS system but are not viewable on the platform or in a emulator. Fat16Rename can be used to rename these filenames into a format that is compatible with the MS-DOS FAT 12/16 file system.
This function does not impose the maximum length limit of 8 characters for the base filename. The list of supported characters were taken from the MS-DOS 6 Concise User's Guide.
func Truncate ¶
Truncate returns the filename in a MS-DOS 8.3 friendly format, truncating the name if necessary. For example, "my backup collection.7zip" would return "my bac~1.7zi". The base filename is permitted to be up to 8 characters long and the optional file extension is 1 to 3 characters long plus a "." separator.
Types ¶
This section is empty.