Hello, A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
On Fri, August 28, 2009 09:02, Yin Jintao wrote: > You can using Glib.Environment.get_current_dir() to get current directory. That's *not* what Arkadi asked for. It's the current directory and that's quite unlikely to be the directory it is installed in, which he wanted. The standard way to find the installation directory is by resolving the name in argv[0] (argv being the parameter passed to function main), which gives you the name of your binary. However (unlike in scripts where the interpreter has expanded it already) it may not include path, in which case you have to search it in $PATH. The GLib.Environment.find_program_in_path will do it. There is a method that will be easier on most unix systems (and even on Cygwin), but less portable. GLib.FileUtils.read_link on "/proc/self/exe" will give you the name of your executable with full path and all links resolved (because kernel actually reverse-calculates it from the open file). Windows have their own API for determining path to the running executable, but I don't think Vala has bindings for it (but it could be done). > 2009/8/28 Arkadi Viner <[email protected]> >> 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. -- - Jan Hudec <[email protected]> _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
