Re: Current Working Directory



On Wed, 2005-08-17 at 16:57 +1000, Nick Watts wrote:
Writing a GTK app under win32. When I use "Open With" to open 
a file with my app, the current working directory is the one the file 
is in rather than the one my app is in.

How can I set the cwd to the path my app is in?

On installation you should set up a registry entry:

HKEY_LOCAL_MACHINE\Software\YourApplicationName

... and add the key ....

InstallationDirectory 

... with the path where you installed the package.

As Example,

Name: HKLM\Software\YourApplicationName\InstallationDirectory
Type: REG_SZ
Data: "C:\Program Files\YourApplicationName"


Then you can use,

gchar*  install_dir;

install_dir =  g_win32_get_package_installation_directory
                                            ("YourApplicationName",
                                             NULL);
chdir((const gchar*) install_dir);

g_free(install_dir);



Hope this helps.
-- 
Iago Rubio




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]