Standard RTL Path Functions across the Supported Target Platforms

From RAD Studio
Jump to: navigation, search

Go Up to Using the RTL in Multi-Device Applications


The following table lists the RTL file path functions that are appropriate for each of the Supported Target Platforms.

For example, if you need to access or reference the home path of your application, this table shows how to construct the reference for each supported platform.

Function \ Platform Windows OSX iOS Android
System.SysUtils.pas

GetHomePath

CSIDL_APPDATA

GetEnvironmentVariable('HOME')

GetEnvironmentVariable('HOME')

GetFilesDir --> Internal Memory

System.IOUtils.pas

TPath.GetHomePath

CSIDL_APPDATA

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\Application Data'
  • Vista or later: 'C:\Users\<username>\AppData\Roaming'

A typical result is: '/Users/<username>'

A typical result is:

  • Device: '/private/var/mobile/Applications/<application ID>'
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID> '

A typical result is: '/data/data/<application ID>/files'

TPath.GetTempPath

User 'temp' folder

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\Local Settings\Temp\'
  • Vista or later: ' C:\Users\<username>\AppData\Local\Temp\'

A typical result is: '/var/folders/<random folder name>/'

A typical result is:

  • Device: '/private/var/mobile/Applications/<application ID>/tmp'
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/tmp'

GetExternalFilesDir+'/tmp/'

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/tmp'

TPath.GetLibraryPath

Same path of Executable file.

If the .exe file is 'D:\Test\Example1.exe', a typical result is: 'D:\Test\'

NSLibraryDirectory

A typical result is: '/Users/<username>/Library'

NSLibraryDirectory

A typical result is:

  • Device: '/var/mobile/Applications/<application ID>/Library'
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Library'

GetLibraryPath

A typical result is: '/data/app-lib/<application ID>-1'

GetDocumentsPath

CSIDL_PERSONAL

A typical result is:

  • XP:
  • Vista or later:

NSDocumentDirectory

A typical result is: '/Users/<username>/Documents'

NSDocumentDirectory

A typical result is:

  • Device: '/var/mobile/Applications/<application ID>/Documents'
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Documents'

GetFilesDir -> Internal Memory

TPath.GetSharedDocumentsPath

CSIDL_COMMON_DOCUMENTS

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents'
  • Vista or later: 'C:\Users\Public\Documents'

NSSharedPublicDirectory

A typical result is: '/Users/<username>/Public'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetExternalFilesDir -> External Memory

If device has external storage (for example, SD card), this method returns path name inside external storage.

If device has no external storage, this method returns somewhere inside internal storage.

A typical result is: '/storage/emulated/0/Documents'

TPath.GetCachePath

CSIDL_LOCAL_APPDATA

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\Local Settings\Application Data'
  • Vista or later: 'C:\Users\<username>\AppData\Local'

NSCachesDirectory

A typical result is: '/Users/<username>/Library/Caches'

NSCachesDirectory

A typical result is:

  • Device: '/var/mobile/Applications/<application ID>/Library/Caches'
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Library/Caches'

GetCacheDir -> Internal Memory

A typical result is: '/data/data/<application ID>/cache'

TPath.GetPicturesPath

CSIDL_MYPICTURES

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\My Documents\My Pictures'
  • Vista or later: 'C:\Users\<username>\Pictures'

NSPicturesDirectory

A typical result is: '/Users/<username>/Pictures'

NSPicturesDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Pictures'

GetExternalPicturesDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/Pictures'

TPath.GetSharedPicturesPath

CSIDL_COMMON_PICTURES

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents\My Pictures'
  • Vista or later: 'C:\Users\Public\Pictures'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedPicturesDir -> External Memory Shared

A typical result is: '/storage/emulated/0/Pictures'

TPath.GetPublicPath

CSIDL_COMMON_APPDATA

A typical result is:

  • XP:

Vista or later: 'C:\ProgramData'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetExternalFilesDir -> External

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files'

TPath.GetCameraPath

CSIDL_MYPICTURES

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\My Documents\My Pictures'
  • Vista or later: 'C:\Users\<username>\Pictures'

NSPicturesDirectory

A typical result is: '/Users/<username>'

NSPicturesDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Pictures'

GetExternalCameraDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/DCIM'

TPath.GetSharedCameraPath

CSIDL_COMMON_PICTURES

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents\My Pictures'
  • Vista or later: 'C:\Users\Public\Pictures'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedCameraDir -> External Memory Shared

A typical result is: '/storage/emulated/0/DCIM'

TPath.GetMusicPath

CSIDL_MYMUSIC

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\My Documents\My Music'
  • Vista or later: 'C:\Users\<username>\Music'

NSMusicDirectory

A typical result is: '/Users/<username>'

NSMusicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Music'

GetExternalMusicDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/Music'

TPath.GetSharedMusicPath

CSIDL_COMMON_MUSIC

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents\My Music'
  • Vista or later: 'C:\Users\Public\Music'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedMusicDir -> External Memory Shared

A typical result is: '/storage/emulated/0/Music'

TPath.GetMoviesPath

CSIDL_MYVIDEO

A typical result is:

  • XP:
  • Vista or later: 'C:\Users\<username>\Videos'

NSMoviesDirectory

A typical result is: '/Users/<username>'

NSMoviesDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Movies'

GetExternalMoviesDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/Movies'

TPath.GetSharedMoviesPath

CSIDL_COMMON_VIDEO

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents\My Videos'
  • Vista or later: 'C:\Users\Public\Videos'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedMoviesDir -> External Memory Shared

A typical result is: '/storage/emulated/0/Movies'

TPath.GetAlarmsPath

CSIDL_MYMUSIC

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\My Documents\My Music'
  • Vista or later: 'C:\Users\<username>\Music'

NSMusicDirectory

A typical result is: '/Users/<username>'

NSMusicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Music'

GetExternalAlarmsDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/Alarms'

TPath.GetSharedAlarmsPath

CSIDL_COMMON_MUSIC

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents\My Music'
  • Vista or later: 'C:\Users\Public\Music'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: XXX
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedAlarmsDir -> External Memory Shared

A typical result is: '/storage/emulated/0/Alarms'

TPath.GetRingtonesPath (Same as TPath.GetMusicPath)

The file system directory that serves as a common repository for ringtones sound files.

CSIDL_MYMUSIC

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\My Documents\My Music'
  • Vista or later: 'C:\Users\<username>\Music'

NSMusicDirectory

A typical result is: '/Users/<username>'

NSMusicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Music'

GetExternalRingtonesDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/Ringtones'

TPath.GetSharedRingTonesPath

CSIDL_COMMON_MUSIC

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Documents\My Music'
  • Vista or later: 'C:\Users\Public\Music'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedRingtonesDir -> External Memory Shared

A typical result is: '/storage/emulated/0/Ringtones'

TPath.GetDownloadsPath

CSIDL_LOCAL_APPDATA

A typical result is:

  • XP: 'C:\Documents and Settings\<username>\Local Settings\Application Data'
  • Vista or later: 'C:\Users\<username>\AppData\Local'

NSDownloadsDirectory

A typical result is: '/Users/<username>'

NSDownloadsDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Downloads'

GetExternalDownloadsDir -> External Memory

A typical result is: '/storage/emulated/0/Android/data/<application ID>/files/Download'

TPath.GetSharedDownloadsPath

CSIDL_COMMON_APPDATA

A typical result is:

  • XP: 'C:\Documents and Settings\All Users\Application Data'
  • Vista or later: 'C:\ProgramData'

NSSharedPublicDirectory

A typical result is: '/Users/<username>'

NSSharedPublicDirectory

A typical result is:

  • Device: This function returns an empty string as this directory is currently not supported.
  • Simulator: '/Users/<username>/Library/Application Support/iPhone Simulator/<SDK version>/Applications/<application ID>/Public'

GetSharedDownloadsDir -> External Memory Shared

A typical result is: '/storage/emulated/0/Download'

See Also