How to detect file redirection to the Windows VirtualStore?

前端 未结 3 1309
旧时难觅i
旧时难觅i 2020-12-05 15:42

Since the release of Win Vista, Microsoft introduced file virtualization for legacy applications running as 32bit processes. Released as part of Microsoft\'s User Account Co

3条回答
  •  粉色の甜心
    2020-12-05 16:28

    Sounds like you're trying to flag if you are "running" from the local app data path, in which case:

    var currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);  
    var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
    Console.WriteLine(
        "Current path is:{0}, AppData Path is {1}, Current is subpath of appdata path:{2}",
        currentPath, 
        appDataPath, 
        currentPath.StartsWith(appDataPath)
    );
    

提交回复
热议问题