My favorites | Sign in
Project Logo
             
Search
for
Updated Jan 12, 2008 by jonhohle
Dir  

The Dir class contains methods for interacting with directories: getting lists of files, changing the working directory, and retrieving the working directory among others.

Class Methods

chdir(path) [native]

Changes the current working directory to path.

Dir.chdir('/')                             =>  undefined
Dir.chdir('/does/not/exist'}  =>  _exception thrown_

chroot(path) [native]

Changes the root directory (for an aptly privileged process) to path.

Dir.chroot('/tmp')                     => undefined
Dir.chroot('/does/not/exist') => _exception thrown_

entries(path) [native]

Returns an array of items in path.

Dir.entries('/System')                => [., .., Library]
Dir.entries('/does/not/exist')  => _exception thrown_

foreach(path, callback) [js]

Calls callback for each item in path.

Dir.entries('/System', function(i) { print(i) }) => undefined

mkdir(path) [native]

Creates a new directory named path.

Dir.mkdir('/tmp/dir')             => undefined

pwd() [native]

Returns the current working directory.

Dir.pwd()      => '/Users/youruser'

rmdir(path) [native]

Removes path using the rmdir system call.

Dir.rmdir('/tmp/somedir')      => undefined
Dir.rmdir('/')                              => _exception thrown_

tmpdir() [native]

Returns the systems temporary directory (value stored in the TMP_DIR environment variable).

Dir.tmpdir()        =>   /var/folders/eo/eo3EQOcj47Kt+TI/-Tmp-/

Instance Methods

None implemented.


Sign in to add a comment
Hosted by Google Code