.NET Junction Directories and DirectInfo issues
I am trying to access information under C:\Users\Public\Documents\ which displays as C:\Users\Public\Public Documents\ on explorer. Is there 开发者_开发百科a way to be able to access the DirectoryInfo of a directory under the junction using the pathname displayed in explorer in .NET C#?
When/how are you expecting to get a C:\users\public\public documents
path?
If a user goes to copy/paste from Explorer, the C:\users\public\documents
path will be copied into the clipboard. Going through a SaveFileDialog
also produces the valid path.
If you need a way to access Windows 7 libraries, you can give the Windows API Code Pack a go. You can then access "Public Documents as KnownFolders.PublicDocuments
, for example. From what I can see (I've never used it before), there's still no way to reliably turn C:\users\public\public documents
into a DirectoryInfo
, but you might have better luck digging through the docs.
精彩评论