Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android: Not creating subdir in QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation). Why?
Forum Updated to NodeBB v4.3 + New Features

Android: Not creating subdir in QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation). Why?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 468 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #1

    Hello!
    I have this in my application:

    QString oPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/ApplicationName";
    
    

    and

    bool ADir::mEnsure(QString inPath) {
    
    	QDir oDir(inPath);
    	if (!oDir.exists()) {
    		return oDir.mkpath(".");
    	};
    	return true;
    }
    

    This function ensure dir existence on MacOS and iOS everywhere, on Android everywhere but not in QStandardPaths::GenericDataLocation. Why? The same piece of code working perfectly for Android QStandardPaths::GenericConfigLocation. What am I missing?

    J.HilkJ 1 Reply Last reply
    0
    • B bogong

      Hello!
      I have this in my application:

      QString oPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/ApplicationName";
      
      

      and

      bool ADir::mEnsure(QString inPath) {
      
      	QDir oDir(inPath);
      	if (!oDir.exists()) {
      		return oDir.mkpath(".");
      	};
      	return true;
      }
      

      This function ensure dir existence on MacOS and iOS everywhere, on Android everywhere but not in QStandardPaths::GenericDataLocation. Why? The same piece of code working perfectly for Android QStandardPaths::GenericConfigLocation. What am I missing?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @bogong did you add external write permissions in your manifest and did the runtime permission check before the create attempt?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      B 1 Reply Last reply
      2
      • Quang PhuQ Offline
        Quang PhuQ Offline
        Quang Phu
        wrote on last edited by Quang Phu
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @bogong did you add external write permissions in your manifest and did the runtime permission check before the create attempt?

          B Offline
          B Offline
          bogong
          wrote on last edited by
          #4

          @J-Hilk Thx a lot. I've got it forgotten. I changed manifest file at time of adopting to Qt 5.15.0 and forget to add it to application manifest.

          1 Reply Last reply
          1

          • Login

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