UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    QDir::entryInfoList() return is 0?

    Scheduled Pinned Locked Moved App Development
    10 Posts 4 Posters 902 Views 2 Watching
    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 Offline
        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 Offline
          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 Offline
            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
            • dobeyD Offline
              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 Offline
                wangqinfeng @dobey
                last edited by

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

                dobeyD 1 Reply Last reply Reply Quote 0
                • W Offline
                  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
                  • arubislanderA Online
                    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
                    Google Pixel 3a (20.04 DEV)
                    JingPad (24.04 preview)
                    Meizu Pro 5 (16.04 DEV)

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

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

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

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

                        πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                        Happily running Ubuntu Touch
                        Google Pixel 3a (20.04 DEV)
                        JingPad (24.04 preview)
                        Meizu Pro 5 (16.04 DEV)

                        1 Reply Last reply Reply Quote 0
                        • dobeyD Offline
                          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