After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 105887 - g_get_home_dir() in win98 returns null.
g_get_home_dir() in win98 returns null.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.2.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-02-12 15:54 UTC by Alexander Shaduri
Modified: 2011-02-04 16:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
how to use SHGetSpecialFolderLocation to get "My Documents" directory (918 bytes, text/plain)
2003-03-19 01:07 UTC, Tim Evans
Details

Description Alexander Shaduri 2003-02-12 15:54:02 UTC
g_get_home_dir() returns NULL in win98, while it should return something like 'c:\my documents'.
I checked the source and noticed that it checks for some env. variables, which may work in win2k
but are unavailable in win98. So, I think it should check for the following registry values:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders\, value 'Personal'
or
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell
Folders\, value 'Personal'.

Maybe SHGetSpecialFolderPath (..., CSIDL_PERSONAL, ...) will work too.
Comment 1 Tor Lillqvist 2003-02-13 01:31:35 UTC
Seems reasonable, will implement the Registry lookup.

On Win2k, at least, there is also the "AppData" key that sounds like 
an even more appropriate place for application settings, but not 
perhaps as an equivalent of the Unix "home directory" concept. Hmm, 
in fact I think it's the parent folder of the "My Documents" folder 
that is the equivalent of "home directory", at least on Win2k. 
Whether some application then wants to use the "My Documents" 
or "Application Data" (or even "Local Settings\Application Data") 
subfolder depends on what it is using the home directory for.

But as there is only one g_get_home_dir() function, and not separate 
g_get_user_home_documents_dir() and g_get_user_home_settings_dir() 
ones, probably the "My Documents" is a good compromise.
Comment 2 Tim Evans 2003-03-19 01:06:00 UTC
I will attach a file showing how to use SHGetSpecialFolderLocation
from C to get this folder.  This method is recommended by MS over
using the registry.  I have tested my code on NT4 and XP, but not 9x.
 Note that the simpler function SHGetSpecialFolderPath doesn't work on
NT4.

Also, I think that it might be a good idea to check for the HOME
environment variable first, so that it can be used to override the
other setting.
Comment 3 Tim Evans 2003-03-19 01:07:08 UTC
Created attachment 15108 [details]
how to use SHGetSpecialFolderLocation to get "My Documents" directory
Comment 4 Tor Lillqvist 2003-03-19 03:10:28 UTC
If you read the code, it *does* check HOME first on Windows...

Thanks for the sample code!
Comment 5 Matthias Clasen 2003-06-10 09:57:51 UTC
Move remaining bugs off 2.2.2 target milestone.
Comment 6 Matthias Clasen 2003-08-27 08:06:12 UTC
Move remaining bugs off the 2.2.3 milestone
Comment 7 Tor Lillqvist 2004-05-15 03:39:55 UTC
I am still not convinced that using CSIDL_PERSONAL as an equivalent to the Unix 
HOME is the right thing to do. What about CSIDL_PROFILE? (Or perhaps 
CSIDL_APPDATA or CSIDL_LOCAL_APPDATA?) Or is it so that any of these is better 
than the current approach, using environment variables? But don't all modern 
Windowses always set the USERPROFILE environment variable to the same as 
CSIDL_PROFILE would return anyway?
Comment 8 Elijah Newren 2004-06-19 18:44:20 UTC
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as
Matthias said he was trying to do himself on IRC and was asking for help with. 
If you see this message, it means I was successful at fixing the borken-ness in
bugzilla :)  Sorry for the spam; just query on this message and delete all
emails you get with this message, since there will probably be a lot.
Comment 9 Tor Lillqvist 2004-12-01 20:28:00 UTC
Fixed a while ago in HEAD:

2004-08-25  Tor Lillqvist  <tml@iki.fi>

	(g_get_any_init): Use CSIDL_PROFILE as HOME if not
	overridden by env vars.