It seems to me "--config-file=/DBusEssential/session.conf" is a single argument and not three separate ones.
It seems to me "--config-file=/DBusEssential/session.conf" is a single argument and not three separate ones.
Any details on how "doesn't work" occur?
to_guliang (26th July 2010)
You haven't established whether the command you are trying to run works at all. If you type exactly this:into your terminal, with the same environment as the application will have, does it run? Does it give you meaningful errors if it doesn't?Qt Code:
/DBusEssential/dbus-daemon --config-file=/DBusEssential/session.confTo copy to clipboard, switch view to plain text mode
to_guliang (26th July 2010)
Thanks to wysota and ChrisW67!!!!!!
i must say sorry . today i do as ChrisW67 says, it doesn't work in terminal. I remember that i have tried "/DBusEssential/dbus-daemon --config-file=/DBusEssential/session.conf" in my terminal and it works. the facts prove that i have misremember.
now, i copy the "dbus-daemon.exe" and "session.conf" to the project root directory, the effective code is follows:
Qt Code:
QStringList arguments; arguments << "--config-file=session.conf";To copy to clipboard, switch view to plain text mode
but now there is another problem, a terminal window named "d:\QtProject\dbus-chat\dbus-daemon.exe" will appear in my desktop. As you know, the client won't accept this window.
Maybe there is a better way to autorun the dbus-daemon.exe without the terminal window?
The following code will do the right thing. the "dbus-daemon.exe" will exit if the application exit:
Qt Code:
QStringList arguments; arguments << "--config-file=session.conf"; QProcess myProcess; myProcess.start(program, arguments);To copy to clipboard, switch view to plain text mode
Thanks to all!
Be a little careful because the program's working directory may not be be same as the application executable's location: you might want to use QCoreApplication::applicationDirPath() to find dbus-daemon.
Regarding the console window:
- Does using the DBus "--fork" option help?
- Is "dbus-launch" of any use?
- Does making the command equivalent to "cmd /c start /b dbus-daemon --config-file=session.conf" help?
- Does capturing the program output stream help?
Bookmarks