Last Modified
2012-02-03 11:13:43 +0000
Requires
  • facade
  • fileutils
  • rbconfig
  • windows/path
  • windows/file
  • windows/error
  • windows/limits
  • uri
  • find

Description

Synopsis

Pathname represents a path name on a filesystem. A Pathname can be relative or absolute. It does not matter whether the path exists or not.

All functionality from File, FileTest, and Dir is included, using a facade pattern.

This class works on both Unix and Windows, including UNC path names. Note that forward slashes are converted to backslashes on Windows systems.

Usage

require "pathname2"

# Unix path1 = Pathname.new("/foo/bar/baz") path2 = Pathname.new("../zap")

path1 + path2 # "/foo/bar/zap" path1.dirname # "/foo/bar"

# Windows path1 = Pathname.new("C:\foo\bar\baz") path2 = Pathname.new("..\zap")

path1 + path2 # "C:\foo\bar\zap" path1.exists? # Does the path exist?

Author

Daniel J. Berger djberg96 at gmail dot com imperator on IRC (irc.freenode.net)

Copyright

Copyright (c) 2005-2008 Daniel J. Berger. Licensed under the same terms as Ruby itself.