new instance of Path that represents current path converted to absolute path. Also, this method will automatically do tilde expansion and normalization of path.
Exception if the specified base directory is not absolute.
import dshould; version(Posix) { auto cdir = std.file.getcwd; scope(exit) std.file.chdir(cdir); std.file.chdir("/tmp"); Path("foo/moo").toAbsolute.toString.should.equal("/tmp/foo/moo"); Path("../my-path").toAbsolute.toString.should.equal("/my-path"); Path("/a/path").toAbsolute.toString.should.equal("/a/path"); string home_path = "~".expandTilde; home_path[0].should.equal('/'); Path("~/my/path").toAbsolute.toString.should.equal("%s/my/path".format(home_path)); }
Convert path to absolute path.