Is there a built-in way to compare two strings representing paths in Inno Setup Pascal? If not with one function, then perhaps via some normalisation of the path.
Naively comparing strings is obviously not correct, even if we ignore case with SameText()
(as per the Windows rules).
As a minimum, correct comparison must
- Treat
\
and/
as identical - Ignore multiple separators like
\\
(theat them as one, like the OS) - Ignore trailing separators (to compare directory paths correctly, for which it is mainly needed)
- Resolve paths (
foo\..\bar
equalsbar
, at least iffoo
exists) - etc. (rules are well known)
- Not require the paths actually exist in the file system.
Resolving absolute vs. relative paths is a bonus, but it requires specifying the current path. Perhaps CWD is OK, but I'm not sure Inno accepts relative installation paths anyway.
This must be a fairly common task for an installer, but I'm surprised not to find an easy yet correct solution...