Directories

The Directory object can be used in two ways:

Common directory operations

Get a list of names of files in the current directory:

Directory fileNames
#=> list("cube.io", "cygwin1.bak", ...etc...)

Get the current working directory:

Io> Directory currentWorkingDirectory
#=> /cygdrive/c/lang/IoFull-Cygwin-2006-04-20

Often, Directory (and File) objects are returned by other methods. For example:

files := Directory files  # only returns files
files at(0)
#=> File_0x820c40
items := Directory items
items at(4)
#=> Directory_0x8446b0
items at(4) name
#=> DarkSide-0.0.1 # a directory name

Setting a Directory object to a certain directory and using it:

Io> root := Directory clone setPath("c:/")
#=>  Directory_0x8637b8:

Io> root fileNames
#=> list("AUTOEXEC.BAT", "boot.ini", "CONFIG.SYS", ...)

Checking if a directory exists:

Io> Directory clone setPath("q:/") exists
#=> false