From Xojo Documentation
Returns a FolderItem that represents a file or folder/directory within this FolderItem with the matching name or index passed.
Shortcuts and aliases are resolved on all platforms.
Returns Nil only when some portion of the path to the child does not exist. For example:
will return Nil if:
- SpecialFolder.System is nil or does not exist
- the folder/directory "Yummy" does not exist
Raises UnsupportedFormatException if Name is blank.
f = New FolderItem
g = FromSaveInfo(f.SaveInfo(Volume(0).Child("Documents"), 0))
If g <> Nil Then
Label2.Value = g.NativePath
MessageBox("FolderItem does not exist!")
Trying to access a path where several components of the path do not exist may cause a NilObjectException The following code will do this if :
- the folder foo does not exist on the desktop
- the folder bar does not exist inside folder foo
- and the file somefile does not exist
It does this because
- SpecialFolder.Desktop works and returns a valid non-nil folderitem
- SpecialFolder.Desktop.Child("foo") returns a valid but non-existing folder item (this would allow you to create items that do not exist)
- SpecialFolder.Desktop.Child("foo").child("bar") returns nil
- SpecialFolder.Desktop.Child("foo").child("bar").child("somefile") now tries to use a NIL item to access the file and this causes the NilObjectException