Re: [Vala] Getting path to my program's directory



2009/8/28 Yin Jintao <yinjintao gmail com>:
You can using Glib.Environment.get_current_dir() to get current directory.

Thanks,
Jintao


2009/8/28 Arkadi Viner <arkashkin gmail com>

Hi guys.
I need to execute some program which is located in my program's directory.
Is there any API to get the path to my program's directory?
Thanks.


Just to elaborate a bit, you wouldn't normally run a binary in the
same directory as the binary is located, unless you are working on
windows.  Normal practice is to encode the install location into the
binary, and use that path at runtime - your build tool will probably
do that for you by writing it into a config header during the
configure stage.

get_current_dir() will normally return the directory the user started
the app from.

-- 
Phil Housley



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