void Path::CreateDirectoryPath(const wxFileName &path){ if(!path.IsDir() || path.DirExists()) return; wxArrayString folders = path.GetDirs(); wxString workingpath; //We need to do things differently with a unc path if(path.GetFullPath().Left(2) == "\\\\") workingpath = "\\\\?\\UNC\\" + path.GetVolume() + "\\"; else workingpath = "\\\\?\\" + path.GetVolume() + wxFileName::GetVolumeSeparator() + wxFILE_SEP_PATH; for(unsigned int i = 0; i < folders.GetCount(); i++){ workingpath = workingpath + folders.Item(i) + wxFILE_SEP_PATH; #ifdef __WXMSW__ if(!wxDirExists(workingpath) && !CreateDirectory(workingpath.fn_str(), NULL)){ #else if(!wxDirExists(workingpath) && !wxMkdir(workingpath)){ #endif wxLogError(_("Could not create") + " " + workingpath); } } } wxFileName Path::Normalise(const wxFileName &filename){ wxString path = Path::Normalise(filename.GetFullPath()); return wxFileName(path); }
wxFileName Instance::GetSetting(const wxString &key, wxFileName defValue) const { wxString val; if (config->Read(key, &val)) { if (defValue.IsDir()) return wxFileName::DirName(val); else return wxFileName::FileName(val); } else return defValue; }
FilePath FilePath::FromAbsoluteWx(const wxFileName& wxFn){ assert(wxFn.IsAbsolute()); assert(!wxFn.IsDir()); return FilePath(new PathImpl(wxFn)); }