New doc system done for core
[io.git] / libs / iovm / io / Y_Path.io
blob1c649717e22934da1748ff7cc8d7f64fd13af8c6
1 Path := Object clone do(
2 //metadoc Path category FileSystem
4 //doc Path hasDriveLetters returns true if the platform requires DOS C: style drive letters.
5 hasDriveLetters := System platform containsAnyCaseSeq("Windows") or System platform containsAnyCaseSeq("Cygwin")
7 //doc Path with(aSequence) Returns a new Path object for the given Sequence.
8 with := method(
9 s := Sequence clone
10 call message arguments foreach(arg,
11 v := call sender doMessage(arg)
12 //writeln("appendPathSeq(", v type, ")")
13 if(v == nil, v = "")
14 s appendPathSeq(v)
16 s asSymbol
19 //doc Path isPathAbsolute Returns true if path is absolute, false if it is relative.
20 isPathAbsolute := method(p,
21 absolute := false
22 try (
23 if (hasDriveLetters,
24 absolute = p at(0) isLetter and p at(1) asCharacter == ":" or p at(0) asCharacter == "/" or p at(0) asCharacter == "\\"
26 absolute = p at(0) asCharacter == "/"
29 absolute
32 //doc Path absolute Returns an absolute version of the path.
33 absolute := method(path,
34 if(isPathAbsolute(path),
35 path
37 with(Directory currentWorkingDirectory, path)