Creating Path /data/print
-
wrote on 2 Mar 2020, 20:51 last edited by
I have a directory named "/data". I have permissions to this directory (755). The owner is my user name for both group and user. Then I try to do the following:
QDir path("/data/print"); if(!path.exists()){ if(!path.mkdir(".")){ // always calling this code as it fails // checked and new directory is not there } }
I am running Ubuntu 18.04. Qt 5.12.5. 64 bit. mingw.
-
Hi,
Why are you using "." for your createDir call ?
-
wrote on 2 Mar 2020, 21:10 last edited by
Okay, this works:
path.mkdir(path.path())
Annoying and redundant, but it works.
-
wrote on 3 Mar 2020, 00:36 last edited by Pl45m4 3 Mar 2020, 00:39
A directory name starting with
.
will hide the folder. So maybe the directory was there, but you couldn't see it.I dont know if
QDir
orQFile
can access hidden dirs or files, so I guess that's the reason why the check failed all the time (if nothing else went wrong) -
wrote on 3 Mar 2020, 01:46 last edited by
@Pl45m4 said in Creating Path /data/print:
I dont know if QDir or QFile can access hidden dirs or files
Yes, they can.
1/6