-                    wxFileName path;
-                    if ( wxDirExists(*it) )
-                    {
-                        path = wxFileName::DirName(w.GetPath() + *it);
-                    }
-                    else
-                    {
-                        path = wxFileName::FileName(w.GetPath() + *it);
-                    }
+                    const wxString fullpath = w.GetPath() +
+                                                wxFileName::GetPathSeparator() +
+                                                  *it;
+                    const wxFileName path(wxDirExists(fullpath)
+                                            ? wxFileName::DirName(fullpath)
+                                            : wxFileName::FileName(fullpath));