This SystemDataPaths, UserDataPaths, AppDataPaths class will be supported on Windows 10 Fall creators updated version build or greater and Windows 10 SDK 16999.
SystemDataPaths
SystemDataPaths class is use to retrieve the system directory path information (like Environment class in Win32 application), following are SystemDataPaths properties, To access propertices , we have to use the GetDefault( ) function , like
- SystemDataPaths.GetDefault().Fonts
- public string Fonts { get; }
- public string ProgramData { get; }
- public string Public { get; }
- public string PublicDesktop { get; }
- public string PublicDocuments { get; }
- public string PublicDownloads { get; }
- public string PublicMusic { get; }
- public string PublicPictures { get; }
- public string PublicVideos { get; }
- public string System { get; }
- public string SystemArm { get; }
- public string SystemHost { get; }
- public string SystemX64 { get; }
- public string SystemX86 { get; }
- public string UserProfiles { get; }
- public string Windows { get; }
Ex
Retrieve complete systemdata path information,
- CreateSystemPath("Font Path : ", SystemDataPaths.GetDefault().Fonts),
- CreateSystemPath("ProgramData : ", SystemDataPaths.GetDefault().ProgramData),
- CreateSystemPath("Public : ", SystemDataPaths.GetDefault().Public),
- CreateSystemPath("PublicDesktop : ", SystemDataPaths.GetDefault().PublicDesktop),
- CreateSystemPath("PublicDocuments : ", SystemDataPaths.GetDefault().PublicDocuments),
- CreateSystemPath("Public Downloads : ", SystemDataPaths.GetDefault().PublicDownloads),
- CreateSystemPath("Public Music : ", SystemDataPaths.GetDefault().PublicMusic),
- CreateSystemPath("Public Pictures : ", SystemDataPaths.GetDefault().PublicPictures),
- CreateSystemPath("Public Videos : ", SystemDataPaths.GetDefault().PublicVideos),
- CreateSystemPath("System : ", SystemDataPaths.GetDefault().System),
- CreateSystemPath("System Arm: ", SystemDataPaths.GetDefault().SystemArm),
- CreateSystemPath("SystemHost : ", SystemDataPaths.GetDefault().SystemHost),
- CreateSystemPath("SystemX64 : ", SystemDataPaths.GetDefault().SystemX64),
- CreateSystemPath("SystemX86 : ", SystemDataPaths.GetDefault().SystemX86),
- CreateSystemPath("UserProfiles : ", SystemDataPaths.GetDefault().UserProfiles),
- CreateSystemPath("Windows : ", SystemDataPaths.GetDefault().Windows)
Output
UserDataPaths
UserDataPaths class is use to retrieve the user based directory path information. We can retrieve information based on current user(default) or other user information, for other user, we have to pass the user object as an argument
UserDataPaths properties
- public string CameraRoll { get; }
- public string Cookies { get; }
- public string Desktop { get; }
- public string Documents { get; }
- public string Downloads { get; }
- public string Favorites { get; }
- public string History { get; }
- public string InternetCache { get; }
- public string LocalAppData { get; }
- public string LocalAppDataLow { get; }
- public string Music { get; }
- public string Pictures { get; }
- public string Profile { get; }
- public string Recent { get; }
- public string RoamingAppData { get; }
- public string SavedPictures { get; }
- public string Screenshots { get; }
- public string Templates { get; }
- public string Videos { get; }
retrieve the user based information call the GetForUser function.
ex
- var allUserInfo = await User.FindAllAsync();
- foreach(var user in allUserInfo) {
- userPaths.FallSystemInfos.Add(CreateSystemPath("Desktop", UserDataPaths.GetForUser(user).Desktop));
- }
Retrieve the default user information use the GetDefault( ) function.
- UserDataPaths.GetDefault().Desktop
Ex
Retrieve default User information,
- CreateSystemPath("Desktop : ", UserDataPaths.GetDefault().Desktop),
- CreateSystemPath("LocalAppData", UserDataPaths.GetDefault().LocalAppData),
- CreateSystemPath("CameraRoll", UserDataPaths.GetDefault().CameraRoll),
- CreateSystemPath("Cookies", UserDataPaths.GetDefault().Cookies),
- CreateSystemPath("Documents", UserDataPaths.GetDefault().Documents),
- CreateSystemPath("Downloads", UserDataPaths.GetDefault().Downloads),
- CreateSystemPath("Favorites", UserDataPaths.GetDefault().Favorites),
- CreateSystemPath("History", UserDataPaths.GetDefault().History),
- CreateSystemPath("InternetCache", UserDataPaths.GetDefault().InternetCache),
- CreateSystemPath("LocalAppDataLow", UserDataPaths.GetDefault().LocalAppDataLow),
- CreateSystemPath("Music", UserDataPaths.GetDefault().Music),
- CreateSystemPath("Pictures", UserDataPaths.GetDefault().Pictures),
- CreateSystemPath("Profile", UserDataPaths.GetDefault().Profile),
- CreateSystemPath("Recent", UserDataPaths.GetDefault().Recent),
- CreateSystemPath("RoamingAppData", UserDataPaths.GetDefault().RoamingAppData),
- CreateSystemPath("SavedPictures", UserDataPaths.GetDefault().SavedPictures),
- CreateSystemPath("Screenshots", UserDataPaths.GetDefault().Screenshots),
- CreateSystemPath("Templates", UserDataPaths.GetDefault().Templates),
- CreateSystemPath("Videos", UserDataPaths.GetDefault().Videos)
Output
AppDataPaths
AppDataPaths class is use to retrieve the application installed directory information, This AppDataPaths class is provides two types of the installed information
- Default
Default function provides application installed based directory information
- User
Retrieve the path information based on the user, like one or more user login to the application, this function provides each user gets the different path)
- public string Cookies { get; }
- public string Desktop { get; }
- public string Documents { get; }
- public string Favorites { get; }
- public string History { get; }
- public string InternetCache { get; }
- public string LocalAppData { get; }
- public string ProgramData { get; }
- public string RoamingAppData { get; }
Ex
Retrieve app based information
- CreateSystemPath("Desktop : ", AppDataPaths.GetDefault().Desktop),
- CreateSystemPath("Cookies : ", AppDataPaths.GetDefault().Cookies),
- CreateSystemPath("Documents : ", AppDataPaths.GetDefault().Documents),
- CreateSystemPath("Favorites : ", AppDataPaths.GetDefault().Favorites),
- CreateSystemPath("History : ", AppDataPaths.GetDefault().History),
- CreateSystemPath("InternetCache : ", AppDataPaths.GetDefault().InternetCache),
- CreateSystemPath("LocalAppData : ", AppDataPaths.GetDefault().LocalAppData),
- CreateSystemPath("ProgramData : ", AppDataPaths.GetDefault().ProgramData),
- CreateSystemPath("RoamingAppData : ", AppDataPaths.GetDefault().RoamingAppData)
Output
Conclusion
I hope you can understand what is use of the SystemDataPaths, UserDataPaths, AppDataPaths classes