这篇教程C++ IsDir函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IsDir函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDir函数的具体用法?C++ IsDir怎么用?C++ IsDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IsDir函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: switchwxString FileData::GetEntry( fileListFieldType num ) const{ wxString s; switch ( num ) { case FileList_Name: s = m_fileName; break; case FileList_Size: if (!IsDir() && !IsLink() && !IsDrive()) s.Printf(wxT("%ld"), m_size); break; case FileList_Type: s = GetFileType(); break; case FileList_Time: if (!IsDrive()) s = GetModificationTime(); break; #if defined(__UNIX__) || defined(__WIN32__) case FileList_Perm: s = m_permissions; break;#endif // defined(__UNIX__) || defined(__WIN32__) default: wxFAIL_MSG( wxT("unexpected field in FileData::GetEntry()") ); } return s;}
开发者ID:DavidBailes,项目名称:audacity,代码行数:35,
示例2: wxTwxString FileData::GetHint() const{ wxString s = m_filePath; s += wxT(" "); if (IsDir()) s += _("<DIR>"); else if (IsLink()) s += _("<LINK>"); else if (IsDrive()) s += _("<DRIVE>"); else // plain file s += wxString::Format( _("%ld bytes"), m_size ); s += wxT(' '); if ( !IsDrive() ) { s << GetModificationTime() << wxT(" ") << m_permissions; } return s;};
开发者ID:DavidBailes,项目名称:audacity,代码行数:25,
示例3: wxTwxString wxFileData::GetHint() const{ wxString s = m_filePath; s += wxT(" "); if (IsDir()) s += _("<DIR>"); else if (IsLink()) s += _("<LINK>"); else if (IsDrive()) s += _("<DRIVE>"); else // plain file s += wxString::Format(wxPLURAL("%ld byte", "%ld bytes", m_size), wxLongLong(m_size).ToString().c_str()); s += wxT(' '); if ( !IsDrive() ) { s << GetModificationTime() << wxT(" ") << m_permissions; } return s;}
开发者ID:mheinsen,项目名称:wxWidgets,代码行数:26,
示例4: WildLexCDstatic void WildLexCD(struct cd_parse_s *cps, ASCII * match){ struct parsedname pn; LEVEL_DEBUG("FTP Wildcard patern matching: Path=%s, Pattern=%s, rest=%s", SAFESTRING(cps->buffer), SAFESTRING(match), SAFESTRING(cps->rest)); /* Check potential length */ if (strlen(cps->buffer) + OW_FULLNAME_MAX + 2 > PATH_MAX) { cps->ret = -ENAMETOOLONG; return; } if ( FS_ParsedName(cps->buffer, &pn) != 0 ) { cps->ret = -ENOENT; return; } if (!IsDir(&pn)) { cps->ret = -ENOTDIR; } else { struct wildlexcd wlcd = { NULL, match, cps, }; int root = (cps->buffer[1] == '/0'); wlcd.end = &cps->buffer[strlen(cps->buffer)]; if (root) { --wlcd.end; } wlcd.end[0] = '/'; FS_dir(WildLexCDCallback, &wlcd, &pn); if (root) { ++wlcd.end; } wlcd.end[0] = '/0'; // restore cps->buffer } FS_ParsedName_destroy(&pn);}
开发者ID:M-o-a-T,项目名称:owfs,代码行数:35,
示例5: ProcessDirIFXRESULT IFXOSFileIterator::GetPlugins( IFXString *subPath ){ IFXRESULT result = IFX_OK; WIN32_FIND_DATA data; BOOL res = FALSE; HANDLE hdl; IFXString tempPath; // find and store all files in this dir ProcessDir( subPath ); // now process subdirs IFXString localPath( m_pluginLocation ); localPath.Concatenate( subPath ); localPath.Concatenate( IFXOSFI_EXTALL ); hdl = FindFirstFile( localPath.Raw(), &data ); // if there are no any file/directory then skip next block if( INVALID_HANDLE_VALUE != hdl ) { // keep searching while there are any files/directories do { // create full path to the found object tempPath.Assign( &m_pluginLocation ); tempPath.Concatenate( subPath ); tempPath.Concatenate( data.cFileName ); // we already found and stored all files we wanted, so check if found object is // a) a directory, // b) its nesting doesn't exceed the limitation (IFXOSFI_MAXDEPTH), // c) its name isn't a "." or ".." if( IsDir( &tempPath ) > 0 && m_depth < IFXOSFI_MAXDEPTH && wcscmp( data.cFileName, IFXOSFI_CURRDIR ) && wcscmp( data.cFileName, IFXOSFI_UPPRDIR ) ) { // we have found a directory and we want to look in it, so // create its relative path: tempPath.Assign( subPath ); tempPath.Concatenate( data.cFileName ); tempPath.Concatenate( L"//" ); // increment the depth (nesting) m_depth++; // step inside GetPlugins( &tempPath ); // decrement the depth (nesting) m_depth--; } // find next file/directory res = FindNextFile( hdl, &data ); } while( res ); // close handle FindClose( hdl ); } return result;}
开发者ID:ClinicalGraphics,项目名称:MathGL,代码行数:60,
示例6: GetDirsvoid GetDirs(const char* dir, bool recursively, TValueArray<std::string>* result){ FileEnumerator fe(dir, recursively); result->Clear(); while (fe.MoveNext()) if (IsDir(fe.CurrentPath())) result->Add(std::string(fe.CurrentPath()));}
开发者ID:gekola,项目名称:BSUIR-labs,代码行数:8,
示例7: StripFileComponentStroka StripFileComponent(const Stroka& fileName){ Stroka dir = IsDir(fileName) ? fileName : GetDirName(fileName); if (!dir.empty() && dir.back() != GetDirectorySeparator()) { dir.append(GetDirectorySeparator()); } return dir;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:8,
示例8: GetModeint wxTarEntry::GetMode() const{ if (m_IsModeSet || !IsDir()) return m_Mode; else return m_Mode | 0111;}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:8,
示例9: pxAssertMsgwxDirName wxDirName::Combine(const wxDirName &right) const{ pxAssertMsg(IsDir() && right.IsDir(), L"Warning: Malformed directory name detected during wDirName concatenation."); wxDirName result(right); result.Normalize(wxPATH_NORM_ENV_VARS | wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE, GetPath()); return result;}
开发者ID:aerisarn,项目名称:pcsx2,代码行数:8,
示例10: CreateDirRecursive bool CreateDirRecursive(LPCTSTR path) { bool ret = IsDir(path) || CreateDirectory(path, nullptr); if (!ret) { ret = CreateDirRecursive(DirName(path)) && CreateDirectory(path, nullptr); } return ret; }
开发者ID:1ldk,项目名称:mpc-hc,代码行数:8,
示例11: IsDots bool CFileInfoW::IsDots() const { if (!IsDir() || Name.IsEmpty()) return false; if (Name[0] != kDot) return false; return Name.Len() == 1 || (Name[1] == kDot && Name.Len() == 2); }
开发者ID:RobinChao,项目名称:LzmaSDKObjC,代码行数:8,
示例12: __declspec __declspec(dllexport) bool LoadImage(const char *file, unsigned int maxwidth, unsigned int maxheight, ImageInfo *info) { if (!file || !info) return false; if (IsDir(file)) return false; // load the image DWORD dwImageType = GetImageType(file); CxImage *image = new CxImage(dwImageType); if (!image) return false; int actualwidth = maxwidth; int actualheight = maxheight; try { if (!image->Load(file, dwImageType, actualwidth, actualheight) || !image->IsValid()) {#if !defined(_LINUX) && !defined(__APPLE__) int nErr = GetLastError();#else int nErr = errno;#endif printf("PICTURE::LoadImage: Unable to open image: %s Error:%s (%d)/n", file, image->GetLastError(),nErr); delete image; return false; } } catch (...) { printf("PICTURE::LoadImage: Unable to open image: %s/n", file); delete image; return false; } // ok, now resample the image down if necessary if (ResampleKeepAspect(*image, maxwidth, maxheight) < 0) { printf("PICTURE::LoadImage: Unable to resample picture: %s/n", file); delete image; return false; } // make sure our image is 24bit minimum image->IncreaseBpp(24); // fill in our struct info->width = image->GetWidth(); info->height = image->GetHeight(); info->originalwidth = actualwidth; info->originalheight = actualheight; memcpy(&info->exifInfo, image->GetExifInfo(), sizeof(EXIFINFO)); // create our texture info->context = image; info->texture = image->GetBits(); info->alpha = image->AlphaGetBits(); return (info->texture != NULL); };
开发者ID:abs0,项目名称:xbmc,代码行数:58,
示例13: getdircallback/* Get a directory, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */static void getdircallback( void * v, const struct parsedname * const pn_entry ) { struct charblob * cb = v ; const char * buf = FS_DirName(pn_entry) ; CharblobAdd( buf, strlen(buf), cb ) ; if ( IsDir(pn_entry) ) { CharblobAddChar( '/', cb ) ; }}
开发者ID:M-o-a-T,项目名称:owfs,代码行数:14,
示例14: LOG_TRACEvoid CCoreApplication< APPLICATION, SETTINGS >::CheckRunMode(){ LOG_TRACE( "Operating mode check..." ); assert__( !mOperatingInDisplayMode ); QStringList args = arguments(); args.removeFirst(); QString wkspc_dir; mOperatingInDisplayMode = !args.empty() && !IsDir( args[ 0 ] ); //no workspace, but there are command line arguments: let the old BratDisplay ghost take the command}
开发者ID:BRAT-DEV,项目名称:main,代码行数:9,
示例15: EnumDirint EnumDir(char* pchDir){ int i; char buf[256]; char* path; int dirlen = strlen(pchDir) + 1; int pathlen = 0; char** dirlist = NULL; int dircount = 0; for (i = ReadDir(pchDir, buf); !i; i = ReadDir(NULL, buf)) { int len; if (buf[0] == '.' && (buf[1] == 0 || (buf[1] == '.' && buf[2] == 0))) continue; len = dirlen + strlen(buf) + 1; if (len > pathlen) { if (pathlen) free(path); path = malloc(len); pathlen = len; } sprintf(path, "%s/%s", pchDir, buf); if (IsDir(path)) { if (!(dircount % PRE_ALLOC_UNIT)) { dirlist = realloc(dirlist, (dircount + PRE_ALLOC_UNIT) * sizeof(char*)); } dirlist[dircount++] = strdup(buf); } else { if (!(filecount % PRE_ALLOC_UNIT)) { filelist = realloc(filelist, (filecount + PRE_ALLOC_UNIT) * sizeof(char*)); } filelist[filecount++] = strdup(path + prefixlen); //printf("%s/n", path); } } for (i = 0; i < dircount; i++) { int len = dirlen + strlen(dirlist[i]) + 1; if (len > pathlen) { if (pathlen) free(path); path = malloc(len); pathlen = len; } sprintf(path, "%s/%s", pchDir, dirlist[i]); free(dirlist[i]); EnumDir(path); } free(dirlist); if (pathlen) free(path); return 0;}
开发者ID:as2120,项目名称:ZAchieve,代码行数:57,
示例16: OutHelpvoid CommandData::ProcessCommand(){#ifndef SFX_MODULE const wchar *SingleCharCommands=L"FUADPXETK"; if (Command[0]!=0 && Command[1]!=0 && wcschr(SingleCharCommands,Command[0])!=NULL || *ArcName==0) OutHelp(*Command==0 ? RARX_SUCCESS:RARX_USERERROR); // Return 'success' for 'rar' without parameters.#ifdef _UNIX if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName)))) wcsncatz(ArcName,L".rar",ASIZE(ArcName));#else if (GetExt(ArcName)==NULL) wcsncatz(ArcName,L".rar",ASIZE(ArcName));#endif if (wcschr(L"AFUMD",*Command)==NULL) { if (GenerateArcName) GenerateArchiveName(ArcName,ASIZE(ArcName),GenerateMask,false); StringList ArcMasks; ArcMasks.AddString(ArcName); ScanTree Scan(&ArcMasks,Recurse,SaveSymLinks,SCAN_SKIPDIRS); FindData FindData; while (Scan.GetNext(&FindData)==SCAN_SUCCESS) AddArcName(FindData.Name); } else AddArcName(ArcName);#endif switch(Command[0]) { case 'P': case 'X': case 'E': case 'T': case 'I': { CmdExtract Extract(this); Extract.DoExtract(); } break;#ifndef SILENT case 'V': case 'L': ListArchive(this); break; default: OutHelp(RARX_USERERROR);#endif } if (!BareOutput) mprintf(L"/n");}
开发者ID:MisterZeus,项目名称:SNES-Tracker,代码行数:56,
示例17: ZIPExtractint APIENTRY ZIPExtract(char* pstrToExt, char* pstrSaveAs){ if (g_uf) { CreateDir(pstrSaveAs); if (!IsDir(pstrSaveAs)) Extract(pstrToExt, pstrSaveAs, g_uf); } return 1;}
开发者ID:LameAss-Studio,项目名称:trans3,代码行数:10,
示例18: GetLastDirNameString PathUtil::GetLastDirName(const String &path){ String tempPath = path; if(!IsDir(tempPath)) return INVALID_PATH; tempPath = tempPath.substr(0, tempPath.length() - 1); return GetPureFilename(tempPath, true);}
开发者ID:carriercomm,项目名称:Lord-3,代码行数:10,
示例19: FormatPathString PathUtil::GetParentPath(const String &fileOrPath){ String tempFile = fileOrPath; FormatPath(tempFile); if(IsDir(tempFile)) { tempFile = tempFile.substr(0, tempFile.length() - 1); } tempFile = GetFileDirPath(tempFile); return tempFile;}
开发者ID:carriercomm,项目名称:Lord-3,代码行数:12,
示例20: CMemEntry::~CMemEntry()//// Destruct.// { if (iLink.iNext!=NULL) iLink.Deque(); delete iName; if (IsDir()) delete iDir; }
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:12,
示例21: OutHelpvoid CommandData::ProcessCommand(){#ifndef SFX_MODULE if (Command[1] && strchr("FUADPXETK",*Command)!=NULL || *ArcName==0) OutHelp();#ifdef _UNIX if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName)))) strcat(ArcName,".rar");#else if (GetExt(ArcName)==NULL) strcat(ArcName,".rar");#endif if (strchr("AFUMD",*Command)==NULL) { StringList ArcMasks; ArcMasks.AddString(ArcName); ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS); FindData FindData; while (Scan.GetNext(&FindData)==SCAN_SUCCESS) AddArcName(FindData.Name,FindData.NameW); } else AddArcName(ArcName,NULL);#endif switch(Command[0]) { case 'P': case 'X': case 'E': case 'T': case 'I': { CmdExtract Extract; Extract.DoExtract(this); } break;#if !defined(GUI) && !defined(SILENT) case 'V': case 'L': ListArchive(this); break; default: OutHelp();#endif }#ifndef GUI if (!BareOutput) mprintf("/n");#endif}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:53,
示例22: OutHelpvoid CommandData::ProcessCommand(){#ifndef SFX_MODULE const char *SingleCharCommands="FUADPXETK"; if (Command[1] && strchr(SingleCharCommands,*Command)!=NULL || *ArcName==0) OutHelp(); //get filename *ArcName#ifdef _UNIX if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName)))) strcat(ArcName,".rar");#endif //printf("test4 %c %s/n",*Command,ArcName); //找文件,将ArcName传到FindData.Name if (strchr("AFUMD",*Command)==NULL) { StringList ArcMasks; ArcMasks.AddString(ArcName); ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS); FindData FindData; while (Scan.GetNext(&FindData)==SCAN_SUCCESS) AddArcName(FindData.Name,FindData.NameW); //FindData.Name "ere.rar" }#endif switch(Command[0]) { case 'P': case 'X': case 'E': case 'T': case 'I': { printf("/nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/n"); CmdExtract Extract; Extract.DoExtract(this); printf("/nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/n"); } break;#ifndef SILENT case 'V': case 'L': ListArchive(this); break; default: OutHelp();#endif } if (!BareOutput) mprintf("/n");}
开发者ID:sevenshine,项目名称:crackRar,代码行数:52,
示例23: GetFileTypewxString wxFileData::GetFileType() const{ if (IsDir()) return _("<DIR>"); else if (IsLink()) return _("<LINK>"); else if (IsDrive()) return _("<DRIVE>"); else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND) return m_fileName.AfterLast(wxT('.')); return wxEmptyString;}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:13,
示例24: EnsureDirbool PathUtil::EnsureDir(const String &dir){ if(!IsDir(dir)) return false; if(!IsDirExist(dir)) { if(!CreateDir(dir)) return false; } return true;}
开发者ID:carriercomm,项目名称:Lord-3,代码行数:13,
示例25: MOcheckvoidPathFinder::AddPaths(const String & ipathlist, bool recursive, bool prepend){ char *work = new char[ipathlist.length()+1]; char *found, *save_ptr; String tmp; String subdirList = wxEmptyString; MOcheck(); wxStrcpy(work,ipathlist.c_str()); found = wxStrtok(work, PATHFINDER_DELIMITER, &save_ptr); while(found) { if(prepend) pathList.push_front(found); else pathList.push_back(found); if(recursive && IsDir(found)) // look for subdirectories { tmp = String(found) + ANYFILE; wxString nextfile = wxFindFirstFile(tmp.c_str(), wxDIR); while ( !nextfile.empty() ) { if(IsDir(nextfile)) { if(subdirList.length() > 0) subdirList += _T(":"); subdirList = subdirList + String(nextfile); } nextfile = wxFindNextFile(); } } found = wxStrtok(NULL, PATHFINDER_DELIMITER, &save_ptr); } delete[] work; if(subdirList.length() > 0) AddPaths(subdirList, recursive);}
开发者ID:vadz,项目名称:mahogany,代码行数:39,
示例26: whileU8 *DirFile(U8 *dirname,U8 *name=NULL,U8 *_extension=NULL){ /* Strips file from dirname, scans for file upward until found or returns default. ("/TempleOS/Kernel/Hash1a.CPP.Z",NULL,NULL) returns "D:/TempleOS/Kernel" ("/TempleOS/Kernel",NULL,"PRJ.Z") returns "D:/TempleOS/Kernel/Kernel.PRJ.Z" ("/TempleOS/Kernel/Dsk",NULL,"PRJ.Z") returns "D:/TempleOS/Kernel/Kernel.PRJ.Z" ("/TempleOS/Apps/MusicOrgan","Load","CPP.Z") returns "D:/TempleOS/Apps/MusicOrgan/Load.CPP.Z" */ U8 *st=DirNameAbs(dirname),*st2,*st3,*result,*dft=NULL,*ext; if (_extension && *_extension) { if (*_extension=='.') ext=StrNew(_extension); else ext=MSPrintF(".%s",_extension); } else ext=StrNew(""); while (StrOcc(st,'/')&&!IsDir(st)) StrLastRem(st,"/"); while (StrOcc(st,'/')) { st2=StrNew(st); st3=StrNew(st); StrLastRem(st2,"/",st3); if (name) result=MSPrintF("%s/%s%s",st,name,ext); else { if (*ext) result=MSPrintF("%s/%s%s",st,st3,ext); else result=StrNew(st); } if (!dft) dft=StrNew(result); if (!*ext&&(!name||!*name)||FileFind(result)) { Free(st3); Free(st2); Free(st); Free(dft); Free(ext); return result; } Free(st); st=st2; Free(st3); } Free(st); Free(ext); return dft;}
开发者ID:IAmAnubhavSaini,项目名称:templeos,代码行数:50,
示例27: MakeOptDestvoid MakeOptDest(const std::string &src, std::string &dest){ TSTLStrSize len = dest.length(); // Strip trailing /'s while (len && (dest[len-1] == '/')) { dest.erase(len-1, 1); len--; } if (IsDir(dest)) dest = JoinPath(dest, BaseName(src));}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:14,
示例28: switchUInt32 CItem::GetWinAttributes() const{ DWORD winAttributes = 0; switch(MadeByVersion.HostOS) { case NFileHeader::NHostOS::kFAT: case NFileHeader::NHostOS::kNTFS: if (FromCentral) winAttributes = ExternalAttributes; break;#ifdef FILE_ATTRIBUTE_UNIX_EXTENSION case NFileHeader::NHostOS::kUnix: case NFileHeader::NHostOS::kMac: case NFileHeader::NHostOS::kOSX: winAttributes = (ExternalAttributes & 0xFFFF0000) | FILE_ATTRIBUTE_UNIX_EXTENSION; if (winAttributes & (NFileHeader::NUnixAttribute::kIFDIR << 16)) winAttributes |= FILE_ATTRIBUTE_DIRECTORY; return winAttributes;#endif default: winAttributes = 0; // must be converted from unix value; } bool fileIsDir = IsDir();#ifdef __APPLE_CC__ //FIX FOR OS X: It appears that certain archivers don't properly record //the file permissions. This is particularly annoying when the executable //permission is lost. An app bundle will fail to launch silently (only //logging a message in the console, that the user might not check). //The OS X Archiver Utility resolves this by unconditionally setting the //executable permission on each file if the host OS is not explicitly //specified as unix. Due to the lack of an elegant solution here, we //do the same thing below. if(MadeByVersion.HostOS!=NFileHeader::NHostOS::kUnix) { //The MySetFileAttributes function (FileDir.cpp) takes care of applying the umask for us. //It expects the unix mode to be in the upper word, hence the <<16. mode_t typeMask = fileIsDir?S_IFDIR:S_IFREG; winAttributes = (((typeMask | 0777))<<16) | FILE_ATTRIBUTE_UNIX_EXTENSION; }#endif if (fileIsDir) // test it; winAttributes |= FILE_ATTRIBUTE_DIRECTORY; return winAttributes;}
开发者ID:ethereon,项目名称:p7zip-hybrid,代码行数:49,
注:本文中的IsDir函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ IsDirectory函数代码示例 C++ IsDialogMessage函数代码示例 |