Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Equivalent library paths

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

Am migrating apps from XP to Windows 7 and the question of equivalent paths has arisen.

By that I mean, an application would access images through the XP path
Code:
C:\Documents and Settings\UserName\My Documents\My Pictures\picture

So what might the full equivalent Windows 7 path be assuming there to be a 'picture' folder under 'My Pictures'?

TIA

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Applications are meant to reach these paths through the Special Folder calls to shell32.dll, not by hard-coded alternatives.

Who is to say where they are? They may not be on C:, or on the local system at all (though that's not likely). They tend to be on the boot drive unless relocated via GPO or direct registry hacking, but the boot/system drive can easily be D: or almost anything.

Then there is the question of what "UserName" is. If a user is renamed after being created Windows does not rename the associated profile and profile folders.
 
dilettante

Thanks for your reply, the comments in which have been noted.

Have been pushed into migrating apps to Windows 7 by users who would not touch Vista, but because of ageing hardware are now being forced down the Windows 7 route.

Thus my understanding of the way developers should approach Windows 7 is vitually non-existent.

What is working, as a short term fix, is the creation of an appropriate folder on the shared C drive, (yes, I know ), and hard coding the path to that folder.

Then it's back to the drawing board to study the Microsoft mindset. [sad]

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Normally its easier if you use the environment variables. That way it doesn't matter if it changes, Windows Keeps the variables updated. Assuming the redirection of the folder was done through Windows.

So you'd want %USERPROFILE%\Pictures


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Sorry for the double post.

The variable is %USERPROFILE% it gets automatically changed into the path of the current users folder.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
There are at least two problems with the environment variable approach.

Users and other programs can modify environment variable values, making them unreliable. In non-English locales the "Pictures" subfolder is not spelled "Pictures" at all.

The Shell calls are always reliable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top