You are here

improper pathing in gimp portable code

6 posts / 0 new
Last post
dopper
Offline
Last seen: 15 years 6 months ago
Joined: 2007-01-02 13:15
improper pathing in gimp portable code

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

lists the path to where users store their windows shell folder data.(desktop, startmenu, my documents, application data, favourites, local settings, etc)

Gimp appears to have a home and desktop shortcut hardcoded to look to C:\Documents and Settings\[User Name]\ for the home icon, but shouldn't the "Home" icon be the windows equivalent "My Documents" and link to wherever that is in the registry key mentioned above?

Power users usually modify the paths of the windows shell folders and keep data on a separate partition from the operating system.

John T. Haller
John T. Haller's picture
Online
Last seen: 17 min 5 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Lots of apps do that

Lots of apps do that. Rather than reading it from the registry, they just pull the %USERPROFILE% environment variable and then tack on Application Data, Desktop, etc. Actually, nearly every app I've worked with in investigating it's portability does. It's partially because Windows doesn't expose those other directories as environment variables and some apps don't bother with the registry... especially cross-platform apps. %USERPROFILE% is equivalent to %HOME% on UNIX... so they read that... and then, for Windows, they just assume the rest. If you'd like this changed... ask the GIMP folks.

Sometimes, the impossible can become possible, if you're awesome!

dopper
Offline
Last seen: 15 years 6 months ago
Joined: 2007-01-02 13:15
that's incorrect though

Windows has shorthand for shell folders...

ie:

%USERPROFILE%\Application Data

incorrectly links to the non existing location:
C:\Documents and Settings\userprofile\Application Data

The proper shorthand:
%appdata%

correctly links to
W:\user7483\AppData

(by using the %appdata% environment variable, windows simply simply reads where the Application Data resides by reading the registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)

Microsoft has a GUI tool for winXP called tweakui that allows you to specify the location of shell folders such as the desktop, my documents, etc listed in the registry key I mentioned above: http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

I realize there's a lot use the variable "%USERPROFILE%\Application Data" but that is not the correct way to link to Application Data.

On a default system %USERPROFILE%\Application Data will work fine but will be broken on some systems.

%appdata% is the proper variable to use.

John T. Haller
John T. Haller's picture
Online
Last seen: 17 min 5 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
The way it is...

That's just the way it is... and you gotta deal with it. It doesn't matter what's correct if thousands of apps do it a different way.

%USERPROFILE% is what people use... and it maps to C:\Documents and Settings\[username]\ by default. You *SHOULD* create a proper location for it as LOTS AND LOTS of programs use it (GIMP, Borland Delphi, DivX, musikCube, etc on my PC at the moment).

Sometimes, the impossible can become possible, if you're awesome!

dopper
Offline
Last seen: 15 years 6 months ago
Joined: 2007-01-02 13:15
Thank you for your

Thank you for your impressively quick replies John.

For some reason though the shortcut to Desktop in portable win32 gimp does not link to %USERPROFILE%\Desktop

The Gimp desktop link appears properly coded to find the modified location of the Desktop. (W:\user7483\Desktop) But in windows when I enter the command "Desktop" in the run dialog it takes me to C:\Documents and Settings\username\Desktop

...go figure Smile

For anyone interested in a workaround, It appears you can modify the location of the %USERPROFILE% variable by modifying randomly named keys beneath the following registry location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

The string to be modified is called "ProfileImagePath" and it defaults to: %SystemDrive%\Documents and Settings\username (which is where the "home" icon links to in win32 gimp portable)

dopper
Offline
Last seen: 15 years 6 months ago
Joined: 2007-01-02 13:15
Followup

To modify your shell folders you can use Microsofts tweakui (instead of manually editing the registry). However, as previously stated windows and the many apps that run on it aren't consistent in the way they access your shell folders (desktop, my documents, favourites, etc) whether from the registry or using shorthand variables.

I came across a sysinternals application that allows the creation of symbolic links in win2k and newer for users who may find it to be of use.

It can be downloaded from here:
http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx

It's especially useful if you dual boot multiple operating systems and want to share your desktop and home/my documents folder, etc. or just find apps are always looking to the default profile location \Documents and Settings\username (since you can't edit the profile location using tweakui...it requires a manually registry edit)

Topic locked