Recent

Author Topic: [SOLVED] GetUserDir gives wrong location  (Read 4763 times)

Adrie

  • New member
  • *
  • Posts: 9
[SOLVED] GetUserDir gives wrong location
« on: August 07, 2012, 04:14:51 pm »
I have redirected the My Documents folder in WinXP to a network location (F:\). All my data are stored there and my program should find the data it neads in that location. When I go to My Documents in any program I end up in F:\.

But when I call GetUserDir the function returns C:\Documents and Settings\Owner\My Documents which is empty because Windows uses the network location.

Is there a workaround for this?

Thanks in advance.
« Last Edit: August 08, 2012, 11:26:12 am by Adrie »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: GetUserDir gives wrong location
« Reply #1 on: August 07, 2012, 04:58:14 pm »
AFAIK GetUserDir asks Windows about the folder, so...

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: GetUserDir gives wrong location
« Reply #2 on: August 07, 2012, 05:06:39 pm »
To be precise, it calls SHGetFolderPath with CSIDL_PROFILE argument.
Quote
But when I call GetUserDir the function returns C:\Documents and Settings\Owner\My Documents
Are you sure? The function should return only until Owner, the My Documents part is not included. As in above URL, you could manually call the respective API with CSIDL_PERSONAL instead of CSIDL_PROFILE to get your My Documents folder (a bit confusing to read %))

Adrie

  • New member
  • *
  • Posts: 9
[SOLVED] Re: GetUserDir gives wrong location
« Reply #3 on: August 08, 2012, 11:25:22 am »
Thanks. You put me on the right track. De unit windirs.pp contains a wrapper for the windows function. This works fine. The function GetWindowsSpecialDir(CSIDL_PERSONAL) gives me the right location (F:\).

 

TinyPortal © 2005-2018