Find directory of "My Documents" or local equivalent
Posted on 2007-07-21
I need to specify a subdirectory relative to the "My documents" path. I'd like to do that with hardcoding the path. Initially I tried
Type DirPath = '%HOMEDRIVE%%HOMEPATH%\My Documents\Admin\logs\' ;
Well, I get "illegal filename" when using the %HOMEDRIVE% stuff. I cant use the GetEnviromentVariable (as recomended in many answers on EE) as this is Delphi5 and it isnt in help (or is there a unit that isnt covered in Help?) so I assume that is D6 or above.
Also, what is the trick to get the name of "My Documents" ? It is "Dokumenter" on Danish Windows as an example (and I did discover it in the registry one time long ago) The whole path for MyDocuments would do nicely (and thus ellminate the need for HOMEDRIVE/PATH)
Delphi 5, running on Windows XP