Qt rmdir function
-
Hi All,
I'd like to know why rmdir function sometimes runs and some times doesn't run.
The very strange thing is that it doesn't run even if the folder that I'm deleting is empty and it's not open.Thanks and regards.
-
Does your application have enough rights to delete the folder? Maybe root created it and your application is not allowed to remove it.
-
My app create folder, than i supposed that the answer to your questio is yes.
-
Are your directories empty? The docs of [[Doc:QDir]] state:
bq. The directory must be empty for rmdir() to succeed.
-
Is the directory empty when you try to delete it? Can you provide a small compilable test case that reproduces it so that we can try it please?
-
Found my problem: My folder is not empty because system doesn't permit to remove a file that my app create.
I create file, write into and also close.
Why in your opinion? -
Under Linux you can determine the permission of files to be created with umask
-
We don't know without more info. What OS are you on? Does anything else have a handle to your file? Is it a race condition? Please make a small compilable example.
-
Found and closed all my problems!
i created my files into my folder using a QThread but the delete operation was done from main thread... then main thread wasn't able to delete all files. -
Aha so a race condition then. They are always fun ;-)
-
Good to know :) don't forget to mark thread as [solved], please.