FolderItem.Constructor(path as String, pathMode as FolderItem.PathModes, followAlias as Boolean = true)

From Xojo Documentation

Constructor
FolderItem.Constructor(path as String , pathMode as PathModes, followAlias as Boolean = true)

New in 2019r2

Creates a new FolderItem. When you create a FolderItem with the New command, you can pass the full or relative path to the new FolderItem as an optional parameter.

Notes

If the path points to an alias or shortcut, the file will resolve to the file pointed to by the alias or shortcut. If you need to point to the alias/shortcut itself, use GetTrueFolderItem in place of this constructor.

The optional PathMode parameter allows you to specify the type of path: Native, Shell, or URL. If Path cannot be resolved to a FolderItem, an UnsupportedFormatException is raised. This is notably the case when a folder does not exist within the given Path or when you do not have the correct access permissions for something in the path. Only the last component of the path is allowed not to exist.


Shell Path

If you pass a Shell path, it must be an absolute path. If not, an UnsupportedFormatException will result. See the ShellPath property of the FolderItem class for information about shell paths. If you pass FolderItem.PathTypeURL, it must begin with "file:///" or "file://localhost/".

Shell paths can contain escaped characters, so:

 New FolderItem("/home/path/with\ space", Folderitem.pathModes.Shell)

is the same as:

 New FolderItem("/home/path/with space", FolderItem.pathModes.Native)


Notes for Mac

The FolderItem.ShellPath function is useful when invoking a command through a Shell object but UNIX commands invoked with a Declare statement require a POSIX path (i.e. a NativePath), not a Shell path (the difference is that some characters are escaped in a ShellPath, while they are not in a POSIX path).

Examples

The following example passes the path to the new FolderItem.

Var f As FolderItem
f = New FolderItem("myDoc.txt")

It specifies the name of the new FolderItem and it is located in the default folder.


In the next example, a FolderItem is created from a shell path.

Var f As New FolderItem("/Users/geoff", FolderItem.pathModes.Shell)

See Also