TuttleOFX  1
tuttle::common Namespace Reference

Namespaces

namespace  details
namespace  formatters

Data Structures

class  Color

Functions

boost::filesystem::path applicationFilepath (const std::string &argv0, const boost::filesystem::path &currentPath)

Function Documentation

boost::filesystem::path tuttle::common::applicationFilepath ( const std::string &  argv0,
const boost::filesystem::path &  currentPath 
)

Returns the directory that contains the application executable.

On Mac OS X this will point to the directory actually containing the executable, which may be inside of an application bundle (if the application is bundled).

Warning:
On Linux, this function will try to get the path from the {/proc} file system. If that fails, it assumes that {argv[0]} contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.

In Symbian this function will return the application private directory, not the path to executable itself, as those are always in {/sys/bin}. If the application is in a read only drive, i.e. ROM, then the private path on the system drive will be returned.

Todo:
on windows check which is the first local file or file in PATH...

Definition at line 56 of file applicationPath.cpp.

References DIRLIST_SEP_CHARS, DIRSEP, and OFX::memory::free().

Referenced by main().

Here is the call graph for this function: