diff options
| author | Jonathan Bauer | 2011-01-27 13:24:10 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2011-01-27 13:24:10 +0100 |
| commit | 5808c2cc7b9e8e74710113f5904e9aa93f41f2bf (patch) | |
| tree | 424dd4a58f2384ad86c5d03b821bb65fb3090b84 /src/fbgui.cpp | |
| parent | changed getPath() function, now uses /proc/self/exe to get the path. (diff) | |
| download | fbgui-5808c2cc7b9e8e74710113f5904e9aa93f41f2bf.tar.gz fbgui-5808c2cc7b9e8e74710113f5904e9aa93f41f2bf.tar.xz fbgui-5808c2cc7b9e8e74710113f5904e9aa93f41f2bf.zip | |
getPath(): using qDebug() instead of std::cout
Diffstat (limited to 'src/fbgui.cpp')
| -rw-r--r-- | src/fbgui.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 825af9c..1d84c11 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -23,11 +23,14 @@ void printUsage() exit(1); } +// This function returns the path of the application as a string. std::string getPath() { char result[ PATH_MAX ]; - size_t count = readlink("/proc/self/exe", result, PATH_MAX); - return std::string( result, (count > 0) ? count : 0); + + ssize_t length = readlink("/proc/self/exe", result, PATH_MAX); + //return result; + return std::string( result, (length > 0) ? length : 0); } int main(int argc, char *argv[]) @@ -60,8 +63,9 @@ int main(int argc, char *argv[]) opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } // Get the application path and prints on screen. - std::string appPath = getPath(); - std::cout << "Application path: " << appPath << endl; + QString qs = QString::fromStdString(getPath()); + qDebug() << "Application Path: " << qs << endl; + // 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? |
