Delphi - Comparing two pathnames when one is UNC and one is drive letter-specified

荒凉一梦 提交于 2019-12-07 05:42:01

问题


I have a situation where a user can specify two separate pathnames, and I need to check whether one pathname is "inside" the other one. I can do this if both pathnames are UNC, or both are drive-letter-based, but what if they are mixed?

Can you "normalise" a path such as "C:\Program Files" to "\\[this computer name]\C\Program Files"? Obviously, I can't go the other way, as a network folder in UNC format may not have a corresponding drive letter mapped to it.


回答1:


Have a look at ExpandUNCFileName function.



来源:https://stackoverflow.com/questions/10458753/delphi-comparing-two-pathnames-when-one-is-unc-and-one-is-drive-letter-specifi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!