Module

Xojo.IO.SpecialFolder


Warning

This item was deprecated in version 2020r2. Please use SpecialFolder as a replacement.

Description

The SpecialFolder modules provides access to OS-specific folders.

Method descriptions


Xojo.IO.SpecialFolder.ApplicationSupport

ApplicationSupport As FolderItem

The location of application support files.

Windows

Mac

Linux

iOS

UsersUserNameAppDataRoaming

/Users/UserName/Library/Application Support

/home/UserName/

../Library/ApplicationSupport

Warning

A RuntimeException will be raised if the folder does not exist.

Dim appSupport As Xojo.IO.FolderItem
appSupport = Xojo.IO.SpecialFolder.ApplicationSupport

Xojo.IO.SpecialFolder.Caches

Caches As FolderItem

The OS folder for storing cache data.

{| class="genericTable" ! width=25% | Windows ! width=25% | Mac ! width=25% | Linux ! width=25% | iOS |- | C:UsersUserNameAppDataLocalMicrosoftWindowsINetCache| /Users/UserName/Library/Caches | /home/UserName/.cache/ | ../Library/Caches |- |}

Warning

A RuntimeException will be raised if the folder does not exist.

Dim cache As Xojo.IO.FolderItem
cache = Xojo.IO.SpecialFolder.Caches

Xojo.IO.SpecialFolder.Documents

Documents As FolderItem

The Document folder is where you will likely want to place most user-created files or data.

Windows

Mac

Linux

iOS

C:UsersUserNameDocuments

/Users/UserName/Documents

/home/UserName/Documents/

../Documents

Warning

A RuntimeException will be raised if the folder does not exist.

Dim docFile As Xojo.IO.FolderItem
docFile = Xojo.IO.SpecialFolder.Documents.Child("MyDocument.txt")

Xojo.IO.SpecialFolder.GetResource

GetResource(name As String) As FolderItem

Gets the specified file (by name) located in the Resource folder of the app's main bundle (Mac or iOS) or in the Resource folder on Windows, Linux and console apps.

Use a Copy Files Build Step to copy files into the Resource folder.

Warning

An InvalidArgumentException will be raised if the file the does not exist.

Gets a file that has been copied to the Resource folder:

Dim bundleFile As Xojo.IO.Folderitem
bundleFile = Xojo.IO.SpecialFolder.GetResource("AppDatabase.sqlite")

Xojo.IO.SpecialFolder.Temporary

Temporary As FolderItem

The user's temporary folder.

{| class="genericTable" ! width=25% | Windows ! width=25% | Mac ! width=25% | Linux ! width=25% | iOS |- | C:UsersUserNameAppDataLocalTemp| /var/folders/gp/wtyftxf176l22dz9qlwqw5v40000gn/T (varies) | /tmp/ | .../tmp |- |}

Warning

A RuntimeException will be raised if the folder does not exist.

Dim tmp As Xojo.IO.FolderItem
tmp = Xojo.IO.SpecialFolder.Temporary

Notes

For desktop, web and console projects you can create a Xojo.IO.FolderItem from a FolderItem returned from a classic framework class or method. Use this to access the classic SpecialFolder for more available locations:

Dim desktopClassic As FolderItem = SpecialFolder.Desktop
Dim desktop As New Xojo.IO.FolderItem(desktopClassic.NativePath.ToText)

All path locations noted for the methods below are from recent versions of the various operating systems. Keeps in mind that paths can vary across OS versions and in the case of Linux, specific distributions. These operating systems were used to determine paths: * Windows 10 Anniversary Edition * macOS Sierra 10.12.1 * Linux Mint 18 * iOS 10.1

Compatibility

All project types on all supported operating systems.

See also

FolderItem class