Documentation
¶
Overview ¶
Package fsmap implements DOS-style drive mappings over a Unix filesystem.
Index ¶
- func PathEntryToUnix(dir string, dm *DriveMap) string
- func SplitPath(pathVal string) []string
- type DriveMap
- func (dm *DriveMap) AddDrive(letter, unixPath string)
- func (dm *DriveMap) CurrentDOSPath() string
- func (dm *DriveMap) CurrentDrive() string
- func (dm *DriveMap) CurrentUnixPath() string
- func (dm *DriveMap) GetCWD(letter string) string
- func (dm *DriveMap) ResolvePath(dosPath string) (string, error)
- func (dm *DriveMap) SetCWD(letter, unixPath string)
- func (dm *DriveMap) SetCurrentDrive(letter string) error
- func (dm *DriveMap) ToDOS(unixPath string) string
- func (dm *DriveMap) ToUnix(dosPath string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PathEntryToUnix ¶
PathEntryToUnix converts a single PATH entry to a Unix directory path. Unix absolute paths (starting with '/') are returned unchanged. Everything else is resolved through the DriveMap (e.g. C:\usr\bin -> /usr/bin).
Types ¶
type DriveMap ¶
type DriveMap struct {
// contains filtered or unexported fields
}
DriveMap maps drive letters to Unix base paths and tracks per-drive working directories.
func (*DriveMap) AddDrive ¶
AddDrive registers a drive letter (e.g. "C") mapped to a Unix path. The path is cleaned and stored; the drive's initial CWD is its root.
func (*DriveMap) CurrentDOSPath ¶
CurrentDOSPath returns the DOS-style path of the current drive's CWD.
func (*DriveMap) CurrentDrive ¶
CurrentDrive returns the active drive letter.
func (*DriveMap) CurrentUnixPath ¶
CurrentUnixPath returns the Unix path of the current drive's CWD.
func (*DriveMap) ResolvePath ¶
ResolvePath resolves a DOS path relative to the current drive and directory. This is the main entry point for path resolution; it delegates to ToUnix.
func (*DriveMap) SetCurrentDrive ¶
SetCurrentDrive switches the active drive.
func (*DriveMap) ToDOS ¶
ToDOS converts a Unix path to a DOS-style path using the best matching drive. Returns the Unix path unchanged if no drive matches.
func (*DriveMap) ToUnix ¶
ToUnix converts a DOS-style path to an absolute Unix path.
Accepted forms:
NUL -> /dev/null C:\foo\bar -> /<base>/foo/bar C:relative -> <drive-cwd>/relative \absolute -> <current-drive-base>/absolute relative -> <current-drive-cwd>/relative
Both \ and / are accepted as separators.