-
September 3rd, 2002, 04:16 PM
#1
Composing directory with relative path
I've once seen a function that would take two strings, one being a path to a folder, and another being a relative path, and return new folder to which relative path was pointing to given the first string. Does anyone remember that function? It is not in the standard list of File I/O API's......
-
September 3rd, 2002, 04:47 PM
#2
Is GetModuleFilename what you are looking for
-
September 3rd, 2002, 05:17 PM
#3
Originally posted by voidspace
Is GetModuleFilename what you are looking for
No....
Here is a better illustration... consider this function in pseudo lang...
str ComposeDirFromRelative(str, str)
and let's say it is called like this:
ComposeDirFromRelative('C:\temp\subtemp', '.\..\subtemp2')
will return C:\temp\subtemp2
-
September 3rd, 2002, 05:33 PM
#4
Do you need a full path for your relative path? Look at _fullpath. Also see _makepath.
-
September 4th, 2002, 09:43 AM
#5
Originally posted by Sam Hobbs
Do you need a full path for your relative path? Look at _fullpath. Also see _makepath.
_makepath is not it, but _fullpath is very close.....
I guess I could do something like this:
curdir = GetCurrentDirectory();
SetCurrentDirectory(basepath);
_fullpath(dest, relativepath);
SetCurrentDirectory(curdir);
and for the current version of the project it will probably do, but the problems with this approch are:
in multithreaded environment, if other threads rely on current folder, this may screw them up.
I'm writing a COM object, so "I don't know anything" about other threads, nor can I do mutual exclusion since I'm in my "own world".
I believe the function that I saw would do almost what _fullpath does... It would take one more parameter, basepath, relative to which it will apply the relative path. It wasn't C run-time function... it looked more like a standard windows API... like SomeFunctionName().
-
September 4th, 2002, 12:10 PM
#6
shlwapi: PathXxxx functions
shlwapi 4.71 (requires IE4, but see below) offers:
PathCombine to concatenate two path's, and
PathCanonicalize to "make it pretty".
from MSDN:
"All systems with Internet Explorer 4.0 or 4.01 will have the associated version of Comctl32.dll and Shlwapi.dll (4.71 or 4.72, respectively). However, for systems prior to Windows 98, Internet Explorer 4.0 and 4.01 can be installed with or without the integrated shell. If they are installed with the integrated shell, the associated version of Shell32.dll will be installed. If they are installed without the integrated shell, Shell32.dll is not updated. In other words, the presence of version 4.71 or 4.72 of Comctl32.dll or Shlwapi.dll on a system does not guarantee that Shell32.dll has the same version number. All Windows 98 systems have version 4.72 of Shell32.dll."
So if you *can* let Nt3.51 and Windows 95 off the cliff, go ahead
(Win95 isn't supported by MS anymore anyway, so there are only a few unlucky NT3.51'ers)
helped?
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|