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. Qt WinRT Folder Permission Issue
Forum Updated to NodeBB v4.3 + New Features

Qt WinRT Folder Permission Issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.2k Views
  • 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.
  • H Offline
    H Offline
    haris123
    wrote on last edited by
    #1

    Hi I already posted a question https://forum.qt.io/topic/64442/qt-winrt-app-cannot-access-file-permission-denied regarding ffmpeg library and video file read, and now I think the entire project should have some permission to access/modify the files system in WinRt Qt App.

    Below is a simple code which create a directory if not exist, bu this also failing always, so I think it permission issue, and there are something should add on AppxManifest.xml.

    QString dirname = QDir::homePath()+"/test";
        QDir dir(dirname);
        if(!dir.exists())
        {
            //dir.mkdir(dirname);
            if(false==dir.mkpath(dirname)){
                qDebug()<<"Creating "<<dirname<<" failed...";
            }
        }
    

    Anyone have faces this before, any suggestion, tips ..

    Thanks in Advance.
    Haris

    1 Reply Last reply
    0
    • patrikdP Offline
      patrikdP Offline
      patrikd
      wrote on last edited by
      #2

      hi haris,
      at least you should use QStandardPaths::writableLocation instead of QDir::home. This returns for the related plattform the paths where the app is allowed to write.
      best,
      patrik

      1 Reply Last reply
      0
      • H Offline
        H Offline
        haris123
        wrote on last edited by
        #3

        I tried these too

        QString dirname =  "C:/Users/haris/Videos/";
        

        But still the error.

        1 Reply Last reply
        0
        • patrikdP Offline
          patrikdP Offline
          patrikd
          wrote on last edited by patrikd
          #4

          Hi haris,
          this works on winrt:(at least in my project)

          
              QDir imagesFolder(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/afolder/");
              if (!imagesFolder.exists())
                  imagesFolder.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/afolder/");
          

          as far as i remember it returns a path to user/AppData/Roaming/.... That is where since win8 (?) application data should be stored.
          best,
          patrik

          1 Reply Last reply
          0
          • H Offline
            H Offline
            haris123
            wrote on last edited by
            #5

            Yes the above code works fine, but in my case I need to set path as user decide, it can be anywhere.

            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