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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get the Home directory

Status
Not open for further replies.

SoujanyaR

Programmer
Feb 1, 2006
8
IN
hi all,

could anyone help me out in composing C/CPP code to find out the home directory ( or atleast the current directory) of any installed application?
you can hardcode the application name.. but we need to get the installation directory

Thanks in advance,
Soujanya.R
 
As far as I know under Windows OSs the home directory of most of the applications is rooted from the user's home directory.

Based on Qt's documentation, the user's home directory can be found like this :
Under Windows the HOME environment variable is used. If this does not exist the USERPROFILE environment variable is used. If that does not exist the path is formed by concatenating the HOMEDRIVE and HOMEPATH environment variables. If they don't exist the rootPath() is used (this uses the SystemDrive environment variable). If none of these exist "C:" is used.

Based on this you can try to call getenv("HOME") to retrieve the current user's home and look for the directories inside it, especially directory "Application Data". Maybe you can find some useful keys inside the windows registry that may list more directly the installed apps and the associated installed paths.

--
Globos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top