QFtp - determine current directory
-
Hi,
how can I determine the current directory on a FTP-Server which I'm connected with? I tried already the rawCommand() of QFtp like this:
ftp.rawCommand("PWD")
So the ftp command "PWD" detects the directory. But how can I access the value of this command? I used a connect statement:
connect(ftp, SIGNAL(commandFinished(int,bool)), this, SLOT(pwd()), Qt::UniqueConnection);
Within the slot "pwd()" I want to get the value of the working directory.
Or is there a better solution how I can determine the directory?
-
Hi,
From a quick look to the sources, isn't
rawCommandReply
what you are looking for ? -
@SGaist said in QFtp - determine current directory:
Hi,
From a quick look to the sources, isn't
rawCommandReply
what you are looking for ?Hi,
I also tried this:
connect(ftp, SIGNAL(rawCommandReply(int,QString)), this, SLOT(pwd()), Qt::UniqueConnection);
But how can I now get the returned value of ftp.rawCommand("PWD") ?
-
@magguz said in QFtp - determine current directory:
@SGaist said in QFtp - determine current directory:
Hi,
From a quick look to the sources, isn't
rawCommandReply
what you are looking for ?Hi,
I also tried this:
connect(ftp, SIGNAL(rawCommandReply(int,QString)), this, SLOT(pwd()), Qt::UniqueConnection);
But how can I now get the returned value of ftp.rawCommand("PWD") ?
Hi, you need to add the parameters (int, QString) from the signal to your slot as they contain the data ;)
Happt New Year!
-
@aha_1980 said in QFtp - determine current directory:
Hi, you need to add the parameters (int, QString) from the signal to your slot as they contain the data ;)
Happt New Year!
Hi, happy new year!
Can you explain this a little bit more in detail? I've put the parameters to the slot like this:
connect(ftp, SIGNAL(rawCommandReply(int,QString)), this, SLOT(pwd(int,QString)), Qt::UniqueConnection);
Is that correct? How I can now get the value of ftp.rawCommand("PWD") ?
-
@magguz said in QFtp - determine current directory:
@aha_1980 said in QFtp - determine current directory:
Hi, you need to add the parameters (int, QString) from the signal to your slot as they contain the data ;)
Happt New Year!
Hi, happy new year!
Can you explain this a little bit more in detail? I've put the parameters to the slot like this:
connect(ftp, SIGNAL(rawCommandReply(int,QString)), this, SLOT(pwd(int,QString)), Qt::UniqueConnection);
Is that correct? How I can now get the value of ftp.rawCommand("PWD") ?
From http://doc.qt.io/archives/qt-4.8/qftp.html#rawCommandReply :
void QFtp::rawCommandReply(int replyCode, const QString & detail)
, so your slot should have the same signature:void YourClass::pwd(int replyCode, const QString &directory)
. Connect the slot to the signal aus you already wrote before.And I guess the answer will now be in the slot parameter
directory
afterwards :) -
@aha_1980 said in QFtp - determine current directory:
From http://doc.qt.io/archives/qt-4.8/qftp.html#rawCommandReply :
void QFtp::rawCommandReply(int replyCode, const QString & detail)
, so your slot should have the same signature:void YourClass::pwd(int replyCode, const QString &directory)
. Connect the slot to the signal aus you already wrote before.And I guess the answer will now be in the slot parameter
directory
afterwards :)Thanks! Now it works great.