Best way to determine if two path reference to same file in Windows?

后端 未结 11 1655
生来不讨喜
生来不讨喜 2020-11-30 11:23

How would I compare 2 strings to determine if they refer to the same path in Win32 using C/C++?

While this will handle a lot of cases it misses some things:

11条回答
  •  不知归路
    2020-11-30 11:57

    Comparing the actual path strings will not produce accurate results if you refer to UNC or Canonical paths (i.e. anything other than a local path).

    shlwapi.h has some Path Functions that may be of use to you in determing if your paths are the same.

    It contains functions like PathIsRoot that could be used in a function of greater scope.

提交回复
热议问题