From c8c50a73ba476dbb4780e41a0b3ecfedf0aa1a55 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 21 Jan 2011 18:48:27 +0100 Subject: Added function for getting the application path... --- fbbrowser/main.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'fbbrowser/main.cpp') diff --git a/fbbrowser/main.cpp b/fbbrowser/main.cpp index 086f2c5..7795688 100644 --- a/fbbrowser/main.cpp +++ b/fbbrowser/main.cpp @@ -3,13 +3,24 @@ #include #include +QString getPath(const char* c) +{ + QString appPath = c; + // Locate last '/' in the full path and remove all the chars after it. + appPath.chop(appPath.length() - 1 + - appPath.lastIndexOf("/", appPath.length()-1)); + qDebug() << "Application path: " << appPath; + return appPath; +} + int main(int argc, char *argv[]) { - // This is the main object of a QT Application. + // This is the main object of a QT Application. QApplication a(argc, argv); // Is this really needed, since we kill the app through the fbbrowser object? QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); - + // Get the application path. + QString appPath = getPath(argv[0]); // This part reads the URL to load from the arguments given through the commandline. QUrl url; if (argc > 1) -- cgit v1.2.3-55-g7522