Delphi - 当一个是UNC时比较两个路径名,一个是驱动器号指定 [英] Delphi - Comparing two pathnames when one is UNC and one is drive letter-specified

查看:159
本文介绍了Delphi - 当一个是UNC时比较两个路径名,一个是驱动器号指定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况,用户可以指定两个单独的路径名,我需要检查一个路径名是否在另一个路径名中。如果两个路径名都是UNC,或者两者都是基于驱动器盘符的,那么我可以这么做,但是如果它们是混合的,那么可以这么做?



你可以规范化一个路径C:\程序文件为\\ [此计算机名称] \C\Program文件?显然,我不能以其他方式,因为UNC格式的网络文件夹可能没有映射到它的相应的驱动器号。

解决方案

查看 ExpandUNCFileName 功能。


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.

解决方案

Have a look at ExpandUNCFileName function.

这篇关于Delphi - 当一个是UNC时比较两个路径名,一个是驱动器号指定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆