alice
library
manual.

Alice Project

The OS.Path structure


________ Synopsis ____________________________________________________

    signature OS_PATH
    structure Path : OS_PATH
  

An extension of the Standard ML Basis' OS.Path structure.

See also: OS, Url


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature OS_PATH =
    sig
	exception Path
	exception InvalidArc

	val parentArc :     string
	val currentArc :    string

	val fromString :    string -> {isAbs : bool, vol : string, arcs : string list}
	val toString :      {isAbs : bool, vol : string, arcs : string list} -> string

	val validVolume :   {isAbs : bool, vol : string} -> bool
	val getVolume :     string -> string
	val getParent :     string -> string

	val concat :        string * string -> string

	val splitDirFile :  string -> {dir : string, file : string}
	val joinDirFile :   {dir : string, file : string} -> string
	val dir :           string -> string
	val file :          string -> string

	val splitBaseExt :  string -> {base : string, ext : string option}
	val joinBaseExt :   {base : string, ext : string option} -> string
	val base :          string -> string
	val ext :           string -> string option

	val mkCanonical :   string -> string
	val isCanonical :   string -> bool

	val mkAbsolute :    {path : string, relativeTo : string} -> string
	val mkRelative :    {path : string, relativeTo : string} -> string
	val isAbsolute :    string -> bool
	val isRelative :    string -> bool
	val isRoot :        string -> bool

	val fromUnixPath :  string -> string
	val toUnixPath :    string -> string
    end
  

________ Description _________________________________________________

Like the Standard ML Basis' OS.Path structure.

Note: Due to the platform independence of Alice the behaviour of OS.Path is not dependent on the host operating system. Instead, paths are always interpreted in a manner conforming to the conventions of Unix-style operating systems.

For the following function, semantics differs slightly from the official specification:

mkRelative {path = path, relativeTo = rel}

Does not raise Path if both arguments are relative paths on the same volume. Instead, resolution is performed as for absolut paths. Here are some examples:

path       relativeTo   mkRelative{path, relativeTo}
"a""""a"
"a"".""a"
"a""a""."
"a""c/d""../../a"
"a""./a""."
"a/""""a/"
"a/b/c""a""b/c"


last modified 2007/Mar/30 17:10