Navigation

    UBports Robot Logo

    UBports Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    QDir::entryInfoList() return is 0?

    App Development
    4
    10
    376
    Loading More Posts
    • 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.
    • W
      wangqinfeng last edited by

      QDir root("/");
      qDebug()<<"app start";
      QFileInfoList list_file=root.entryInfoList();
      qDebug()<<list_file.length();
      for(int i=0;i<list_file.length();i++){
          qDebug()<<list_file[i].fileName()<<list_file[i].filePath();
      }
      

      //I need to list all the files in the root directory, I don't know what to do.

      1 Reply Last reply Reply Quote 0
      • W
        wangqinfeng last edited by

        clickable desktop Return result

        app start
        21
        "." "/."
        ".." "/.."
        "bin" "/bin"
        "boot" "/boot"
        "dev" "/dev"
        "etc" "/etc"
        "home" "/home"
        "lib" "/lib"
        "lib64" "/lib64"
        "media" "/media"
        "mnt" "/mnt"
        "opt" "/opt"
        "proc" "/proc"
        "root" "/root"
        "run" "/run"
        "sbin" "/sbin"
        "srv" "/srv"
        "sys" "/sys"
        "tmp" "/tmp"
        "usr" "/usr"
        "var" "/var"

        The real machine returns to 0

        M 1 Reply Last reply Reply Quote 0
        • M
          matteo @wangqinfeng last edited by

          @wangqinfeng what do you mean by the "Real Machine"? If you mean the UT phone, then probably you'd need to include in your .apparmor file the adequate policy group to grant permission to access the root folder. Have a look at the Apparmor Policy Groups to find out more.

          W 1 Reply Last reply Reply Quote 2
          • dobey
            dobey last edited by

            Why does your app need to traverse the entire filesystem?

            Apps in UT are confined. Your app only has access to its own data/config/cache directories. It cannot access arbitrary files on the system, for security/privacy.

            W 1 Reply Last reply Reply Quote 0
            • W
              wangqinfeng @dobey last edited by

              @dobey Thank you! I want to use my app like a computer!

              dobey 1 Reply Last reply Reply Quote 0
              • W
                wangqinfeng @matteo last edited by

                @matteo
                Thank you for your answer! I want to compile the program on my ubuntu computer to run on my phone.

                1 Reply Last reply Reply Quote 0
                • arubislander
                  arubislander last edited by

                  Is this an app for personal use or are you planning to publish it to the OpenStore at some point?

                  πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                  Happily running Ubuntu Touch
                  BQ Aquaris M10 FHD (RC)
                  Google Pixel 3a (DEV)
                  Meizu Pro 5 (DEV)
                  PinePhone / PineTab UT CE (DEV)

                  W 1 Reply Last reply Reply Quote 0
                  • W
                    wangqinfeng @arubislander last edited by

                    @arubislander Good morning, this is a program I use myself, which is convenient for my management of the server.

                    arubislander 1 Reply Last reply Reply Quote 0
                    • arubislander
                      arubislander @wangqinfeng last edited by

                      @wangqinfeng Ah, then hack away to your heart's content! πŸ‘πŸ½

                      πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                      Happily running Ubuntu Touch
                      BQ Aquaris M10 FHD (RC)
                      Google Pixel 3a (DEV)
                      Meizu Pro 5 (DEV)
                      PinePhone / PineTab UT CE (DEV)

                      1 Reply Last reply Reply Quote 0
                      • dobey
                        dobey @wangqinfeng last edited by

                        @wangqinfeng said in QDir::entryInfoList() return is 0?:

                        @dobey Thank you! I want to use my app like a computer!

                        Apps are confined on the phone and cannot access arbitrary files or directories outside of the app's confinement.

                        You say you want to use it to manage the server, so is what you want to access the root filesystem on that server, rather than on your phone? Or are you trying to turn your phone into some sort of server?

                        It's difficult to provide direction, when we can't understand what you're trying to do exactly. πŸ™‚

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post