Solved Starting a selfmade c++ application via Qprocess
-
@christophator once you solve the issue with the *nix path, you may want to consider using some configuration file (i.e. via QSettings class) to store the path/arguments of the external C++ app to launch so to avoid recompiling your Qt application for Linux, WIndows, etc everytime the path/platform changes
-
@christophator
You should discover why it "did not start" under Linux if you add signal/slot for http://doc.qt.io/qt-5/qprocess.html#errorOccurred. You have done well hooking up the other signals, but you really need that one too, especially for production. -
@koahnig and @Pablo-J-Rogina thank you very much!
I didn't understand how the linux paths work.
I put my c++ application into the current folder of the Qt program and called only the name in the program path.
There it works :)
Now I will get into the QDir and QSettings class to solv it properly. -
@christophator
Linux paths work more-or-less identically to Windows ones, just they use/
instead of\
and don't have a crazy drive letter. -
@JonB
Yeah :D and I didn't realized that I used a ralative path wich starts at the current folder..
Now I got it! -
@christophator
Any path which does not start (very first character) with a/
(Linux) or\
(Windows) is relative. And under Windows be careful with drive letters:D:\fred
is absolute butD:fred
is actually relative, to the current directory on driveD:
, whatever that is. -
@JonB said in Starting a selfmade c++ application via Qprocess:
@christophator
Linux paths work more-or-less identically to Windows ones, just they use/
instead of\
and don't have a crazy drive letter.Not exactly. That seem to reflect the blinker view of linux guys.
Windows does tolerate '/' for a long time already. Me, as a Windows boy, I simply switched to the forward slash long ago.
When you are not using linux for daily work, you ask yourself a lot where you can find that stupid device again.
-
@koahnig
Since you have chosen to question what I wrote (as a simplified answer), I shall return the favour by saying "Not exactly" to you!Not exactly. That seem to reflect the blinker view of linux guys.
Windows does tolerate '/' for a long time already. Me, as a Windows boy, I simply switched to the forward slash long ago.Nope. That's too simplistic, which is why I didn't mention it! Try each of the following:
dir \c dir /c
They don't produce the same, do they? So it's not fair to say that Windows users can use
/
instead of\
, is it? That seem to reflect the blinker view of Windows guys. :) This is only one example..... -
@JonB said in Starting a selfmade c++ application via Qprocess:
@koahnig
Since you have chosen to question what I wrote (as a simplified answer), I shall return the favour by saying "Not exactly" to you!Not exactly. That seem to reflect the blinker view of linux guys.
Windows does tolerate '/' for a long time already. Me, as a Windows boy, I simply switched to the forward slash long ago.Nope. That's too simplistic, which is why I didn't mention it! Try each of the following:
dir \c dir /c
They don't produce the same, do they? So it's not fair to say that Windows users can use
/
instead of\
, is it? That seem to reflect the blinker view of Windows guys. :) This is only one example.....:D
Not sure, if it is the blinker view of Windows guy or of someone concentrating on a specific topic, the path issue, without mentioning it explicitly. ;) Also, if I am not mistaken, is the backslash used mainly for separation in a long path.BTW Have fun to use in Windows
dir \c
which will not work. Also there the recommendation to use better a forward slash will help. ;)
Anyway I am not interested in specific linux nor windows bashing. Especially the backslash within a path and its special meaning within string drives probably most of the developers nuts. Therefore I am gladly using the forward slash whenever possible.
-
BTW Have fun to use in Windows
dir \c
which will not work.? Of course it "works".
dir \c
means "list the file/directory namedc
in the root folder of the current drive". (If there isn't one, of course it reports File not found, but it's still "working".) OTOH,dir /c
means "list all the files in the current directory on the current drive, passing the/c
switch todir
". Quite different. Which is why I would never use or recommend/
instead of\
for paths in Windows, and I'm surprised you get away with it in practice..... Not Linux vs Windows "bashing" (it was you who used the word "blinker"!), just a heads-up as to it's not robust enough to risk IMHO.....