• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IsDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IsDir函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDir函数的具体用法?C++ IsDir怎么用?C++ IsDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IsDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: switch

wxString 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,代码来源:FileDialogPrivate.cpp


示例2: wxT

wxString 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,代码来源:FileDialogPrivate.cpp


示例3: wxT

wxString 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,代码来源:filectrlg.cpp


示例4: WildLexCD

static 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,代码来源:file_cd.c


示例5: ProcessDir

IFXRESULT 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,代码来源:IFXOSFileIterator.cpp


示例6: GetDirs

void 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,代码来源:FileUtils.cpp


示例7: StripFileComponent

Stroka 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,代码来源:dirut.cpp


示例8: GetMode

int wxTarEntry::GetMode() const
{
    if (m_IsModeSet || !IsDir())
        return m_Mode;
    else
        return m_Mode | 0111;

}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:8,代码来源:tarstrm.cpp


示例9: pxAssertMsg

wxDirName 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,代码来源:PathUtils.cpp


示例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,代码来源:PathUtils.cpp


示例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,代码来源:FileFind.cpp


示例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,代码来源:DllInterface.cpp


示例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,代码来源:ow_get.c


示例14: LOG_TRACE

void 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,代码来源:CoreApplication.cpp


示例15: EnumDir

int 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,代码来源:httpvod.c


示例16: OutHelp

void 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,代码来源:cmddata.cpp


示例17: ZIPExtract

int 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,代码来源:tkzip.cpp


示例18: GetLastDirName

String 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,代码来源:PathUtil.cpp


示例19: FormatPath

String 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,代码来源:PathUtil.cpp


示例20:

CMemEntry::~CMemEntry()
//
// Destruct.
//
	{

	if (iLink.iNext!=NULL)
		iLink.Deque();
	delete iName;
	if (IsDir())
		delete iDir;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:12,代码来源:t_romg.cpp



注:本文中的IsDir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsDirectory函数代码示例发布时间:2022-05-30
下一篇:
C++ IsDigit函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap