Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFtp - determine current directory
Forum Updated to NodeBB v4.3 + New Features

QFtp - determine current directory

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    magguz
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From a quick look to the sources, isn't rawCommandReply what you are looking for ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        From a quick look to the sources, isn't rawCommandReply what you are looking for ?

        M Offline
        M Offline
        magguz
        wrote on last edited by
        #3

        @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") ?

        aha_1980A 1 Reply Last reply
        0
        • M magguz

          @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") ?

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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!

          Qt has to stay free or it will die.

          M 1 Reply Last reply
          0
          • aha_1980A aha_1980

            @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!

            M Offline
            M Offline
            magguz
            wrote on last edited by
            #5

            @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") ?

            aha_1980A 1 Reply Last reply
            0
            • M magguz

              @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") ?

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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 :)

              Qt has to stay free or it will die.

              M 1 Reply Last reply
              1
              • aha_1980A aha_1980

                @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 :)

                M Offline
                M Offline
                magguz
                wrote on last edited by
                #7

                @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.

                aha_1980A 1 Reply Last reply
                1
                • M magguz

                  @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.

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @magguz Thanks for reporting back!

                  So please mark this thread as solved now.

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved