当前位置: 首页>>代码示例>>C++>>正文


C++ IsDir函数代码示例

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


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


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