troubleshooting Question

Find directory of "My Documents" or local equivalent

Avatar of Msquare
Msquare asked on
Delphi
9 Comments2 Solutions1097 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
ZhaawZ
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros