%% orig Path declare [Path]={Module.link ['x-oz://system/os/Path.ozf']} %% [1: init] On MacOS, this call results in an error: every path object must end with a slash, even a plain file like '/home/test/tmp.txt/' %% NB: This problem pops up with every definition in the functional Path API, because all rely on Path.make. {Path.make '/home/test/tmp.txt'} %******************** Error: conditional failed ***************** %** %** Missing else clause %** /* %% some kludge to avoid the problem, but this is not the expected way to do things {New Path.'class' init('/home/test/tmp.txt' exact:true)} */ %% The following tests were run on Linux: %% [2: init] {{Path.make '/'} toString($)} %% -> nil {{Path.make '/'} toAtom($)} %% -> '' %% [3] {{Path.make '/'} isAbsolute($)} %% -> false %% NB: several other Path methods fail on "/" as well. %% [4: basename] .. neither correct path, nor does it cut of the dirname {{{Path.make '/home/test.txt'} basename($)} toString($)} %% -> "/homehome/test.txt" %% [5: dirname] ... neither correct path, nor does it cut of the basename {{{Path.make '/home/test/tmp.txt'} dirname($)} toString($)} %% -> "/homehome/testhomehomte/test/tmp.txt" %% [6: basenameString] .. outputs string in list {{Path.make '/home/test/tmp.txt'} basenameString($)} %% ["tmp.txt"] %% [7: resolve] .. garbles the first path and ignores the second instead of appending it {{{Path.make '/home/test/'} resolve('testDir/myFile.txt' $)} toString($)} %% "/homehome/test/" %% [8: isRoot] .. isRoot can not distinguish between empty path and root {{Path.make nil} isRoot($)} %% -> true %% [9: extension] .. extension never returns the extension, always unit for a non-existing extension. BTW: {{Path.make '/home/test/tmp.txt'} extension($)} %% -> unit %% [10: dropExtension] .. dropExtension drops more than the extension {{{Path.make '/home/test/tmp.txt'} dropExtension($)} toString($)} %% "/homehome/test" %% [11: addExtension] .. addExtension drops stuff instead {{{Path.make '/home/test/tmp'} addExtension('txt' $)} toString($)} %% "/homehome/test" %% [12: readdir] .. garbles pathes {Map {{Path.getcwd} readdir($)} fun {$ P} {P toString($)} end}