コード例 #1
0
ファイル: path.cpp プロジェクト: Andy-Amoy/Toucan
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);
}
コード例 #2
0
ファイル: instance.cpp プロジェクト: bartbes/MultiMC4
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;
}
コード例 #3
0
FilePath FilePath::FromAbsoluteWx(const wxFileName& wxFn){
  assert(wxFn.IsAbsolute());
  assert(!wxFn.IsDir());
  return FilePath(new PathImpl(wxFn));
}