Someting wrong with currentPath on linux
-
Hi i have problem with currentPath on linux (debian).
i write simple code:
[code]
#include <QtGui/QApplication>
#include <QtGui>
#include <QtCore>int main(int argc, char *argv[])
{
QApplication a(argc, argv);QLineEdit line; line.setText(QDir::currentPath()); b line.show(); return a.exec();
}
[/code]and now if i build and execute in QtCreator then work, but if i change place binary file then he all time show my home directory (/home/username) . Why ???
-
-
Create a launcher(xxxxx.desktop) for your application, then set currentPath in this file, and start your application using the launcher.
-
Create a shell script for your application, set current path evn in the script.
-
launch your application in a Terminal.
-
....
In addition, do you really want to show currentPath in your LineEdit? or what you want is application's directory?
-
-
I want show directory to binary file .
Can you tell me why its work in terminal ?? -
[quote author="Pablik2005" date="1335814726"]I want show directory to binary file .
Can you tell me why its work in terminal ??[/quote]What you need is
@
QCoreApplication::applicationDirPath ()
@Current Pah, also known as Current Working Directory, is a basic but important concept.
-
its work thx :)