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 1.8k 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
                  JingPad (24.04-1.x daily)
                  OnePlus Nord N10 5G (24.04-2.x daily)
                  PinePhone OG (20.04)
                  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
                      JingPad (24.04-1.x daily)
                      OnePlus Nord N10 5G (24.04-2.x daily)
                      PinePhone OG (20.04)
                      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

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better πŸ’—

                        Register Login
                        • First post
                          Last post