File system

We recommend you use the static class VirtualFileSystem to access files across platforms. It offers all basic operations such as reading, writing, copying, checking existence and deleting files.

Note

The path separator is / (Unix/Linux convention).

Code example

  1. // Open a file through VirtualFileSystem
  2. var gamesave1 = VirtualFileSystem.OpenStream("/roaming/gamesave001.dat", VirtualFileMode.Open, VirtualFileAccess.Read);
  3. // Alternatively, directly access the same file through its file system provider (mount point)
  4. var gamesave2 = VirtualFileSystem.ApplicationRoaming.OpenStream("gamesave001.dat", VirtualFileMode.Open, VirtualFileAccess.Read);

Default mount points

Mount pointDescriptionWritableCloudNotesPCAndroidiOSWindows Phone 8.1
dataApplication data, deployed by packageOutput directory/dataAPK itselfDeployed package directoryInstalledLocation.Path
binaryApplication binaries, deployed by packageUsually the same as app_data (except on Android)Assembly directoryAssembly directoryAssembly directoryAssembly directory
roamingUser specific data (roaming)BackupOutput directory/roaming, %APPDATA%$(Context.getFilesDir)/roamingLibrary/roamingRoaming
localUser application dataBackupOutput directory/local$(Context.getFilesDir)localLibrary/localLocal
cacheApplication cacheDLC, etc. Might be deleted manually by user (restore, clear data, etc…)Output directory/cache, with do-not-back-up flags$(Context.getFilesDir)/cacheLibrary/cachesLocalCache
tmpApplication temporary dataMight be deleted without notice by OSOutput directory/temp, %TEMP%/%APPNAME%$(Context.getCacheDir)tmpTemporary