Help - Search - Members - Calendar
Full Version: How do I know the directory in which foobar2000.exe is?
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
zencd
How do I know (from a component) the directory in which foobar2000.exe is?

(C:\Program Files\foobar2000\ is not an answer.)

UPD: looks like answered, thanks to musicmusic
musicmusic
(Why do you need to know this?)

The answer is GetModuleFileName (note: there exists a utf-8 wrapped version uGetModuleFileName). As per the docs pass NULL for the module handle and you will get the path of the current process. You will need to process the path a bit to remove the process's filename.

Whatever you are doing, remember also core_api::get_profile_path() for the user profile directory (user settings and files etc.).
zencd
Thank you much! get_profile_path() suit my needs even better.

(I need it to access some files in the installation dir. Okay, with no license violation:)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.