PDA

View Full Version : The setWorking Directory doesn't works fine??



DiegoTc
31st December 2010, 16:31
Hi guys
Well I am playing around with the QProcess and I am having this small (big) problem.
When I run the application my current directory is this one

/home/diego/Proyectos_Personales/Ejemplos/Using_QProcess-build-desktop
And I need to make an operation in this directory
/home/diego/Proyectos_Personales/Ejemplos/Using_QProcess-build-desktop/randy-1.0

So I do this

process->setWorkingDirectory(path);
QString x=process->workingDirectory();//This returns me the directory I want :)
//But when I do a pwd
process->execute("pwd");//It return me the original directory :(
process->execute("dh_make -e diegoturcios@ubuntu.com");
process->write("s");//
process->write("\n");


So I don't know how to solved this problem.
Someone can give me an idea?
Thanks

wysota
31st December 2010, 16:35
QProcess::execute() is a static method that doesn't operate on the object you call it from so everything you do with the "process" object is ignored by execute(). Use QProcess::start() instead.