开发者

How to know VirtualStore is applied in my application

开发者 https://www.devze.com 2022-12-17 17:43 出处:网络
I am developing an application which will run on Windows OS. However, when run it on Windows Vista, my application\'s settings is stored in VirtualStore. How to 开发者_StackOverflow社区check VirtualSt

I am developing an application which will run on Windows OS. However, when run it on Windows Vista, my application's settings is stored in VirtualStore. How to 开发者_StackOverflow社区check VirtualStore is being applied in my application (I need a function to check and it must ok on XP, Vista).

And how to get the path of Virtual Store of my application.

Thanks.


My workaround...

You get the user Appdata path:

String appdata = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

Add VirtualStore folder to path:

String VirtualStoreRoot = appdata + "\\VirtualStore";

Create folder:

String backuppath = "C:\\Program Files\\Progname\\backup";
Directory.CreateDirectory(backuppath);

Check created in VirtualStore

String newpath = VirtualStoreRoot + backuppath.Substring(2);
if (Directory.Exists(newpath)){
   backuppath = newpath;
}

I found another stuff:

Isolated Storage with .NET

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号