Summary
When special folder paths on the HoloLens app that is a UWP app, .NET developers can use Environment.SpecialFolder
and Windows.Storage
namespace.
- Environment.SpecialFolder Enum (System) | Microsoft Docs
- Windows.Storage Namespace – Windows UWP applications | Microsoft Docs
This post describes the results of actually running the application on HoloLens 2 and logging folder paths. Please note that the results doesn’t include reading or writing files from the folder.
Scope
- Environment.SpecialFolder
- Windows.Storage.ApplicationData
- Windows.Storage.KnownFolders
- Windows.Storage.SystemDataPaths
- Windows.Storage.UserDataPaths
Prerequisites
- HoloLens 2 (Windows Holographic v21H2)
- Windows 10 v21H2
- Unity 2020.3.29f1
- Visual Studio 2019 v16.11.10
Path
Environment.SpecialFolder
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Roaming
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\Template3D_pzq3xp76mxafg\RoamingState
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\LocalState
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\Template3D_pzq3xp76mxafg\LocalState
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\LocalState\ProgramData
// HoloLens 2 (Windows Holographic)
System.UnauthorizedAccessException: Failed getting the path of a special folder: Access Denied.
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
// PC (Windows 10)
C:\\Users\hiroakit\Documents
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Documents
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)
// PC (Windows 10)
C:\\Users\hiroakit\Pictures
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Pictures
Environment.GetFolderPath(Environment.SpecialFolder.MyVideos)
// PC (Windows 10)
C:\\Users\hiroakit\Videos
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Videos
Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)
// PC (Windows 10)
C:\\Users\Public\Documents
// HoloLens 2 (Windows Holographic)
System.UnauthorizedAccessException: Failed getting the path of a special folder: Access Denied.
Environment.GetFolderPath(Environment.SpecialFolder.CommonPictures)
// PC (Windows 10)
C:\\Users\Public\Pictures
// HoloLens 2 (Windows Holographic)
System.UnauthorizedAccessException: Failed getting the path of a special folder: Access Denied.
Environment.GetFolderPath(Environment.SpecialFolder.CommonVideos)
// PC (Windows 10)
C:\\Users\Public\Videos
// HoloLens 2 (Windows Holographic)
System.UnauthorizedAccessException: Failed getting the path of a special folder: Access Denied.
Windows.Storage.ApplicationData
Windows.Storage.ApplicationData.Current.LocalCacheFolder.Path
// PC (Windows 10)
C:\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\LocalCache
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\Template3D_pzq3xp76mxafg\LocalCache
Windows.Storage.ApplicationData.Current.LocalFolder.Path
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\LocalState
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\Template3D_pzq3xp76mxafg\LocalState
Windows.Storage.ApplicationData.Current.RoamingFolder.Path
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\RoamingState
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\Template3D_pzq3xp76mxafg\RoamingState
Windows.Storage.ApplicationData.Current.SharedLocalFolder.Path
// PC (Windows 10)
C:\\ProgramData\Microsoft\Windows\AppRepository\Families\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\SharedLocal
// HoloLens 2 (Windows Holographic)
System.NullReferenceException: Object reference not set to an instance of an object.
Windows.Storage.ApplicationData.Current.TemporaryFolder.Path
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\TempState
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\Template3D_pzq3xp76mxafg\TempState
Windows.Storage.KnownFolders
Windows.Storage.KnownFolders.AppCaptures.Path
Required Video Library capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
C:\\Users\hiroakit\Videos\Captures
// HoloLens 2 (Windows Holographic)
C:\Data\USERS\hiroakit\Videos\Captures
Windows.Storage.KnownFolders.CameraRoll.Path
Required Picture Library capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
C:\\Users\\hiroakit\Pictures\Camera Roll
// HoloLens 2 (Windows Holographic)
C:\Data\USERS\hiroakit\Pictures\Camera Roll
Windows.Storage.KnownFolders.DocumentsLibrary.Path
Required Documents Library capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
"" // string.Empty;
// HoloLens 2 (Windows Holographic)
"" // string.Empty;
Windows.Storage.KnownFolders.HomeGroup.Path
// PC (Windows 10)
Cannot access Homegroup. Homegroup may not be set up or may have encountered an error.
// HoloLens 2 (Windows Holographic)
Cannot access Homegroup. Homegroup may not be set up or may have encountered an error.
Windows.Storage.KnownFolders.Objects3D.Path
Required 3D Object capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
C:\\Users\hiroakit\3D Objects
// HoloLens 2 (Windows Holographic)
C:\Data\USERS\hiroakit\3D Objects
Windows.Storage.KnownFolders.PicturesLibrary.Path
Required Picture Library capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
"" // string.Empty;
// HoloLens 2 (Windows Holographic)
"" // string.Empty;
Windows.Storage.KnownFolders.SavedPictures.Path
Required Picture Library capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
C:\\Users\hiroakit\Pictures\Saved Pictures
// HoloLens 2 (Windows Holographic)
C:\Data\USERS\hiroakit\Pictures\Saved Pictures\Template3D_pzq3xp76mxafg!App
Windows.Storage.KnownFolders.VideosLibrary.Path
Required Video Library capability, if it isn’t you will get Attempted to perform an unauthorized operation.
// PC (Windows 10)
"" // string.Empty;
// HoloLens 2 (Windows Holographic)
"" // string.Empty;
Windows.Storage.SystemDataPaths
Windows.Storage.SystemDataPaths.GetDefault().Public
// PC (Windows 10)
C:\Users\Public
// HoloLens 2 (Windows Holographic)
U:\Users\Public
Windows.Storage.SystemDataPaths.GetDefault().PublicDocuments
// PC (Windows 10)
C:\Users\Public\Documents
// HoloLens 2 (Windows Holographic)
U:\Users\Public\Documents
Windows.Storage.SystemDataPaths.GetDefault().PublicDownloads
// PC (Windows 10)
C:\Users\Public\Downloads
// HoloLens 2 (Windows Holographic)
U:\Users\Public\Downloads
Windows.Storage.SystemDataPaths.GetDefault().PublicPictures
// PC (Windows 10)
C:\Users\Public\Pictures
// HoloLens 2 (Windows Holographic)
U:\Users\Public\Pictures
Windows.Storage.SystemDataPaths.GetDefault().PublicVideos
// PC (Windows 10)
C:\Users\Public\Videos
// HoloLens 2 (Windows Holographic)
U:\Users\Public\Videos
Windows.Storage.UserDataPaths
Windows.Storage.UserDataPaths.GetDefault().CameraRoll
// PC (Windows 10)
C:\\Users\hiroakit\Pictures\Screenshots
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Pictures\Camera Roll
Windows.Storage.UserDataPaths.GetDefault().Documents
// PC (Windows 10)
C:\\Users\hiroakit\Documents
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Documents
Windows.Storage.UserDataPaths.GetDefault().Downloads
// PC (Windows 10)
C:\\Users\hiroakit\Downloads
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Downloads
Windows.Storage.UserDataPaths.GetDefault().LocalAppData
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local
Windows.Storage.UserDataPaths.GetDefault().LocalAppDataLow
// PC (Windows 10)
C:\\Users\hiroakit\AppData\LocalLow
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\LocalLow
Windows.Storage.UserDataPaths.GetDefault().Pictures
// PC (Windows 10)
C:\\Users\hiroakit\Pictures
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Pictures
Windows.Storage.UserDataPaths.GetDefault().RoamingAppData
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Roaming
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Roaming
Windows.Storage.UserDataPaths.GetDefault().SavedPictures
// PC (Windows 10)
C:\\Users\hiroakit\Pictures\Saved Pictures
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Pictures\Saved Pictures
Windows.Storage.UserDataPaths.GetDefault().Screenshots
// PC (Windows 10)
C:\\Users\hiroakit\Pictures\Screenshots
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Pictures\Screenshots
Windows.Storage.UserDataPaths.GetDefault().Videos
// PC (Windows 10)
C:\\Users\Public\Videos
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\Videos
Other
Path.GetTempPath()
// PC (Windows 10)
C:\\Users\hiroakit\AppData\Local\Packages\b0c4f284-b01c-4ec0-a3c9-af917af79727_bkv2wzhfgj7e0\AC\Temp\
// HoloLens 2 (Windows Holographic)
C:\Data\Users\hiroakit\AppData\Local\Packages\template3d_pzq3xp76mxafg\AC\Temp\
System.Reflection.Assembly.GetExecutingAssembly().Location
// PC (Windows 10)
C:\\work\UWPApp\UWPApp\bin\x86\Debug\AppX\entrypoint\UWPApp.exe
// HoloLens 2 (Windows Holographic)
"" // string.Empty;
References
- Environment.SpecialFolder Enum (System) | Microsoft Docs
- Windows.Storage Namespace – Windows UWP applications | Microsoft Docs
- ApplicationData Class (Windows.Storage) – Windows UWP applications | Microsoft Docs
- KnownFolders Class (Windows.Storage) – Windows UWP applications | Microsoft Docs
- SystemDataPaths Class (Windows.Storage) – Windows UWP applications | Microsoft Docs
- UserDataPaths Class (Windows.Storage) – Windows UWP applications | Microsoft Docs
- App capability declarations – UWP applications | Microsoft Docs