tags:

views:

58

answers:

1

Win32's PathResolve is resolving \temp into c:\temp, even if I run the function from another drive.

In addition, IsRelative() returns false for '\temp' - which makes me wonder what kind of resolution it actually thinks it's doing for this path.

A: 

Perhaps driveless paths default to your system drive?

Jens Björnhager
When? The way I see it paths are always evaluated in the context of a running process which always has a working directory. What sort of API function, when run from a process that has a working directory in D:\SomeDir, interprets a path such as "\temp" to mean "C:\temp"?I just don't get it.
Assaf Lavie
Well, http://msdn.microsoft.com/en-us/library/bb776478%28VS.85%29.aspx speaks of "unqualified" paths, of which I think "\temp" would be a member. My guess is that it expands unqualified paths to the "root device", which is your system drive, and turns up as "C:\temp". If you need to expand it relative to the working directory, you will probably need to use just that, a _relative_ path, such as "temp".
Jens Björnhager
That's inconsistent with the CombinePaths function that takes d:\dir and \otherDir and produces d:\otherDir.
Assaf Lavie
Cant find any win32 function with that name. Are you using .net?
Jens Björnhager
Sorry, I meant PathCombine: http://msdn.microsoft.com/en-us/library/bb773571(v=VS.85).aspx
Assaf Lavie
Well, in PathCombine you explicitly state the drive. It seems that the path needs to begin with a driver letter: "The directory path should be in the form of A:,B:, ..., Z:."
Jens Björnhager