QDir mkdir与绝对路径 [英] QDir mkdir with absolutepath

查看:726
本文介绍了QDir mkdir与绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用Qt创建目录的问题。
我想在documents'dir中创建一个目录,所以我做了一些这样的事情:

  QString路径( C:/用户/ ME /文档/ MyApp的/简档/); 
Qdir dir = QDir :: root();
dir.mkdir(路径);

但这不行!我有分析器的/和\测试,但在两个不起作用的情况下。



我如何创建我的目录?



谢谢。

解决方案

尝试使用 QDir: :mkpath as dir.mkpath(path);


I have problem with the creation of dir with Qt. I would like to create a dir in documents'dir so, I make some things like that :

QString path("C:/Users/Me/Documents/MyApp/profiles/");
Qdir dir = QDir::root();
dir.mkdir(path);

But that doesn't work! I have test with "/" and "\" for the separators but in the two cases that not work.

How I can create my dir?

Thank you.

解决方案

Try to use QDir::mkpath as dir.mkpath(path);

这篇关于QDir mkdir与绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆