Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
QDir mkpath不';不要在android上创建目录_Android_Qt_Qt5_Qdir - Fatal编程技术网

QDir mkpath不';不要在android上创建目录

QDir mkpath不';不要在android上创建目录,android,qt,qt5,qdir,Android,Qt,Qt5,Qdir,每次我启动应用程序时,都会调用mkpath,就好像以前没有创建目录一样,尽管我总是得到“path created”日志。我是否需要指定任何特权以保存到内部存储器中mypath看起来像/data/data/org.qtproject.example.WierszeApp/files/.local/share/libWierszeApp.so/ QDir mypath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));

每次我启动应用程序时,都会调用mkpath,就好像以前没有创建目录一样,尽管我总是得到“path created”日志。我是否需要指定任何特权以保存到内部存储器中
mypath
看起来像
/data/data/org.qtproject.example.WierszeApp/files/.local/share/libWierszeApp.so/

QDir mypath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));

if(!mypath.cd("images"))
{
    if(mypath.mkpath("images"))
        qDebug() << "path created";
    else
        qDebug() << "path not created";
}
else
{
    qDebug() << "inside dir";
}
QDir-mypath(qstandardpath::writeablelocation(qstandardpath::DataLocation));
如果(!mypath.cd(“图像”))
{
if(mypath.mkpath(“图像”))

qDebug()我弄明白了为什么每次都没有创建它。每次我从QtCreator libWierszeApp运行应用程序时,文件夹都被删除了,内容也被删除了。当你从设备运行应用程序时,一切正常。我想它可以报告为bug。

添加
android.permission。将外部存储写入“Permissions”fie清单文件的ld解决问题了吗?