Error in remove empty dirs

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Error in remove empty dirs

Post by dkaip »

Hello.
I am trying to delete recursive empty dirs but taking error that there are not exist.

Code: Select all

 wxString where-wxT("a dir of mine")
        wxMessageBox(where+wxFileName::GetPathSeparator());
        wxFileName::Rmdir(where, wxPATH_RMDIR_FULL);
I don’t know why.
Thank you
Jim.
Kvaz1r
Super wx Problem Solver
Super wx Problem Solver
Posts: 357
Joined: Tue Jun 07, 2016 1:07 pm

Re: Error in remove empty dirs

Post by Kvaz1r »

Are you sure that the path is really exist? How reproduce the behaviour?

Btw, there is annoying bug - wxFileName(directory without final separator).Rmdir(flags) removes the parent directory
so be careful with it.
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: Error in remove empty dirs

Post by dkaip »

In code

Code: Select all

   wxString where;
    {
        wxDirDialog* openDirDialog = new wxDirDialog(NULL, "Choose  directory ", "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
        if (openDirDialog->ShowModal() == wxID_OK)where = openDirDialog->GetPath();
        else return;
        wxFileName::Rmdir(where, wxPATH_RMDIR_FULL);
    }
i am taking error ...
Directory '/home/a/Εικόνες/scan' couldn't be deleted (error 2: No such file or directory)
Also with code ...

Code: Select all

    wxString where;
    {
        wxDirDialog* openDirDialog = new wxDirDialog(NULL, "Choose  directory ", "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
        if (openDirDialog->ShowModal() == wxID_OK)where = openDirDialog->GetPath();
        else return;
        wxFileName::Rmdir(where+wxFileName::GetPathSeparator(), wxPATH_RMDIR_FULL);
    }
Must exist a bug...
Thank you
Jim.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error in remove empty dirs

Post by ONEEYEMAN »

Hi,
Can you post an output of "ls -la /home/a/Εικόνες/"?
Also, what is the user that runs the application?

Thank you.
Post Reply