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

C++ IsDirectory函数代码示例

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

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



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

示例1: GetSize

// Returns the size of filename (64bit)
u64 GetSize(const std::string &filename)
{
	struct stat64 file_info;
#if defined(_WIN32) && defined(UNICODE)
	int result = _wstat64(ConvertUTF8ToWString(filename).c_str(), &file_info);
#else
	int result = stat64(filename.c_str(), &file_info);
#endif
	if (result != 0)
	{
		WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str());
		return 0;
	}

	if (IsDirectory(file_info))
	{
		WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str());
		return 0;
	}

	DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename.c_str(), (long long)file_info.st_size);
	return file_info.st_size;
}
开发者ID:BrainDamage,项目名称:libretro-ppsspp,代码行数:24,代码来源:FileUtil.cpp


示例2: CtdlDirectoryLookup

/*
 * Look up an Internet e-mail address in the directory.
 * On success: returns 0, and Citadel address stored in 'target'
 * On failure: returns nonzero
 */
int CtdlDirectoryLookup(char *target, char *internet_addr, size_t targbuflen) {
	struct cdbdata *cdbrec;
	char key[SIZ];

	/* Dump it in there unchanged, just for kicks */
	safestrncpy(target, internet_addr, targbuflen);

	/* Only do lookups for addresses with hostnames in them */
	if (num_tokens(internet_addr, '@') != 2) return(-1);

	/* Only do lookups for domains in the directory */
	if (IsDirectory(internet_addr, 0) == 0) return(-1);

	directory_key(key, internet_addr);
	cdbrec = cdb_fetch(CDB_DIRECTORY, key, strlen(key) );
	if (cdbrec != NULL) {
		safestrncpy(target, cdbrec->ptr, targbuflen);
		cdb_free(cdbrec);
		return(0);
	}

	return(-1);
}
开发者ID:zcw159357,项目名称:citadel,代码行数:28,代码来源:internet_addressing.c


示例3: CopyDir

// Create directory and copy contents (does not overwrite existing files)
void CopyDir(const std::string &source_path, const std::string &dest_path)
{
#ifndef _WIN32
	if (source_path == dest_path) return;
	if (!File::Exists(source_path)) return;
	if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);

	struct dirent_large { struct dirent entry; char padding[FILENAME_MAX+1]; };
	struct dirent_large diren;
	struct dirent *result = NULL;
	DIR *dirp = opendir(source_path.c_str());
	if (!dirp) return;

	while (!readdir_r(dirp, (dirent*) &diren, &result) && result)
	{
		const std::string virtualName(result->d_name);
		// check for "." and ".."
		if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
			((virtualName[0] == '.') && (virtualName[1] == '.') &&
			(virtualName[2] == '\0')))
			continue;

		std::string source, dest;
		source = source_path + virtualName;
		dest = dest_path + virtualName;
		if (IsDirectory(source))
		{
			source += '/';
			dest += '/';
			if (!File::Exists(dest)) File::CreateFullPath(dest);
			CopyDir(source, dest);
		}
		else if (!File::Exists(dest)) File::Copy(source, dest);
	}
	closedir(dirp);
#endif
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:38,代码来源:FileUtil.cpp


示例4: CopyDir

// Create directory and copy contents (does not overwrite existing files)
void CopyDir(const std::string &source_path, const std::string &dest_path)
{
#ifndef _WIN32
	if (source_path == dest_path) return;
	if (!File::Exists(source_path)) return;
	if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);

	struct dirent *result = NULL;
	DIR *dirp = opendir(source_path.c_str());
	if (!dirp) return;

	while ((result = readdir(dirp)))
	{
		const std::string virtualName(result->d_name);
		// check for "." and ".."
		if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
			((virtualName[0] == '.') && (virtualName[1] == '.') &&
			(virtualName[2] == '\0')))
			continue;

		std::string source, dest;
		source = source_path + virtualName;
		dest = dest_path + virtualName;
		if (IsDirectory(source))
		{
			source += '/';
			dest += '/';
			if (!File::Exists(dest)) File::CreateFullPath(dest);
			CopyDir(source, dest);
		}
		else if (!File::Exists(dest)) File::Copy(source, dest);
	}
	closedir(dirp);
#else
	ERROR_LOG(COMMON, "CopyDir not supported on this platform");
#endif
}
开发者ID:mailwl,项目名称:ppsspp,代码行数:38,代码来源:FileUtil.cpp


示例5: opendir

void UserTable::GetDirectoryTree(const std::string& sPath, TPathList& rResults)
{
  struct dirent* ent;
  DIR* dir;

  dir = opendir(sPath.c_str());
  if (!dir) {
    syslog(LOG_WARNING, "could not open directory %s: %s", sPath.c_str(), strerror(errno));
    return;
  }

  rResults.push_back(sPath);

  ent = readdir(dir);
  while (ent) {
    std::string sFullPath = sPath + "/" + ent->d_name;
    std::string sEntry(ent->d_name);
    if ("." != sEntry && ".." != sEntry && IsDirectory(sFullPath)) {
      GetDirectoryTree(sFullPath, rResults);
    }
    ent = readdir(dir);
  }
  closedir(dir);
}
开发者ID:danfruehauf,项目名称:incron,代码行数:24,代码来源:usertable.cpp


示例6: set

/*
Removes a single directory passed in.
Returns true on success, false on failure.
On a failure, errno will be set (but may be of dubious quality)
and an error logged.
If the path does not exist, return immediately as success.
if the path exists, but is not a directory, the behavior is currently
to return immediately as success, but in the future might fail with
errno==ENOTDIR.

This assumes that the top level directory requires an euid of condor to
remove.
*/
static bool
remove_spool_directory(const char * dir)
{
	if ( ! IsDirectory(dir) ) { return true; }

	Directory spool_dir(dir);
	if( ! spool_dir.Remove_Entire_Directory() )
	{
		dprintf(D_ALWAYS,"Failed to remove %s\n", dir);
		errno = EPERM; // Wild guess.
		return false;
	}

	TemporaryPrivSentry tps(PRIV_CONDOR);
	if( rmdir(dir) == 0 ) { return true; }
	// Save errno in case dprintf mangles.
	int tmp_errno = errno;
	if( errno != ENOENT ) {
		dprintf(D_ALWAYS,"Failed to remove %s: %s (errno %d)\n",
			dir, strerror(errno), errno );
	}
	errno = tmp_errno;
	return false;
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:37,代码来源:spooled_job_files.cpp


示例7: ValidatePath

/*---------------------------------------------------------------------*/
BOOL ValidatePath(CHAR * path, H_ARCHIVE harchive)
{

    _archive[harchive].last_error = ARC_NO_ERROR;
    _archive_error = ARC_NO_ERROR;

    /* Check out the path */
    if (path == NULL)
        _archive_error = ARC_BAD_PATH;

    if (strlen(path) > MAX_PATH_LEN - ARC_PATH_LEN)
        _archive_error = ARC_BAD_PATH;

    if (!IsDirectory(path))
        _archive_error = ARC_BAD_PATH;

    if (_archive_error != ARC_NO_ERROR)
        return (FALSE);

    /* Fully qualify the path */
    QualifyPath(_archive[harchive].path, path);

    return (TRUE);
}
开发者ID:Fran89,项目名称:seiscomp3,代码行数:25,代码来源:open.c


示例8: EnsureBackslashPathSet

bool CTGitPath::Delete(bool bTrash) const
{
	EnsureBackslashPathSet();
	::SetFileAttributes(m_sBackslashPath, FILE_ATTRIBUTE_NORMAL);
	bool bRet = false;
	if (Exists())
	{
		if ((bTrash)||(IsDirectory()))
		{
			std::unique_ptr<TCHAR[]> buf(new TCHAR[m_sBackslashPath.GetLength() + 2]);
			_tcscpy_s(buf.get(), m_sBackslashPath.GetLength() + 2, m_sBackslashPath);
			buf[m_sBackslashPath.GetLength()] = 0;
			buf[m_sBackslashPath.GetLength()+1] = 0;
			bRet = CTGitPathList::DeleteViaShell(buf.get(), bTrash);
		}
		else
		{
			bRet = !!::DeleteFile(m_sBackslashPath);
		}
	}
	m_bExists = false;
	m_bExistsKnown = true;
	return bRet;
}
开发者ID:KristinaTaylor,项目名称:TortoiseSI,代码行数:24,代码来源:TGitPath.cpp


示例9: CreateFullPath

// Creates the full path of fullPath returns true on success
bool CreateFullPath(const std::string& fullPath)
{
  int panicCounter = 100;
  INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str());

  if (Exists(fullPath))
  {
    INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str());
    return true;
  }

  size_t position = 0;
  while (true)
  {
    // Find next sub path
    position = fullPath.find(DIR_SEP_CHR, position);

    // we're done, yay!
    if (position == fullPath.npos)
      return true;

    // Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
    std::string const subPath(fullPath.substr(0, position + 1));
    if (!IsDirectory(subPath))
      File::CreateDir(subPath);

    // A safety check
    panicCounter--;
    if (panicCounter <= 0)
    {
      ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep");
      return false;
    }
    position++;
  }
}
开发者ID:Anti-Ultimate,项目名称:dolphin,代码行数:37,代码来源:FileUtil.cpp


示例10: Delete

// Deletes a given filename, return true on success
// Doesn't supports deleting a directory
bool Delete(const std::string &filename)
{
	INFO_LOG(COMMON, "Delete: file %s", filename.c_str());

	// Return true because we care about the file no 
	// being there, not the actual delete.
	if (!Exists(filename))
	{
		WARN_LOG(COMMON, "Delete: %s does not exists", filename.c_str());
		return true;
	}

	// We can't delete a directory
	if (IsDirectory(filename))
	{
		WARN_LOG(COMMON, "Delete failed: %s is a directory", filename.c_str());
		return false;
	}

#ifdef _WIN32
	if (!DeleteFile(ConvertUTF8ToWString(filename).c_str()))
	{
		WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", 
				 filename.c_str(), GetLastErrorMsg());
		return false;
	}
#else
	if (unlink(filename.c_str()) == -1) {
		WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", 
				 filename.c_str(), GetLastErrorMsg());
		return false;
	}
#endif

	return true;
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:38,代码来源:FileUtil.cpp


示例11: MoveToDir

//----------------------------------------------------------------------------------------
nsresult nsFileSpec::MoveToDir(const nsFileSpec& inNewParentDirectory)
//----------------------------------------------------------------------------------------
{
    // We can only copy into a directory, and (for now) can not copy entire directories
    if (inNewParentDirectory.IsDirectory() && (! IsDirectory() ) )
    {
        char *leafname = GetLeafName();
        nsSimpleCharString destPath(inNewParentDirectory.GetCString());
        destPath += "\\";
        destPath += leafname;
        nsCRT::free(leafname);

        // MoveFile returns non-zero if succeeds
        int copyOK = MoveFile(GetCString(), destPath);

        if (copyOK)
        {
            *this = inNewParentDirectory + GetLeafName(); 
            return NS_OK;
        }
        
    }
    return NS_FILE_FAILURE;
} // nsFileSpec::MoveToDir
开发者ID:bringhurst,项目名称:vbox,代码行数:25,代码来源:nsFileSpecWin.cpp


示例12: InitHomeDir

void InitHomeDir(void)
{
    const std::string & home = Settings::GetHomeDir();

    if(! home.empty())
    {
	const std::string home_maps  = home + SEPARATOR + std::string("maps");
	const std::string home_files = home + SEPARATOR + std::string("files");
	const std::string home_files_save = home_files + SEPARATOR + std::string("save");

	if(! IsDirectory(home))
	    MKDIR(home.c_str());

	if(IsDirectory(home, true) && ! IsDirectory(home_maps))
	    MKDIR(home_maps.c_str());

	if(IsDirectory(home, true) && ! IsDirectory(home_files))
	    MKDIR(home_files.c_str());

	if(IsDirectory(home_files, true) && ! IsDirectory(home_files_save))
	    MKDIR(home_files_save.c_str());
    }
}
开发者ID:asimonov-im,项目名称:fheroes2,代码行数:23,代码来源:fheroes2.cpp


示例13: ScanDirectoryTree

// Scans the directory tree gets, starting from _Directory and adds the
// results into parentEntry. Returns the number of files+directories found
u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
{
	INFO_LOG(COMMON, "ScanDirectoryTree: directory %s", directory.c_str());
	// How many files + directories we found
	u32 foundEntries = 0;
#ifdef _WIN32
	// Find the first file in the directory.
	WIN32_FIND_DATA ffd;

	HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd);
	if (hFind == INVALID_HANDLE_VALUE)
	{
		FindClose(hFind);
		return foundEntries;
	}
	// windows loop
	do
	{
		FSTEntry entry;
		const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else
	struct dirent dirent, *result = NULL;

	DIR *dirp = opendir(directory.c_str());
	if (!dirp)
		return 0;

	// non windows loop
	while (!readdir_r(dirp, &dirent, &result) && result)
	{
		FSTEntry entry;
		const std::string virtualName(result->d_name);
#endif
		// check for "." and ".."
		if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
				((virtualName[0] == '.') && (virtualName[1] == '.') && 
				 (virtualName[2] == '\0')))
			continue;
		entry.virtualName = virtualName;
		entry.physicalName = directory;
		entry.physicalName += DIR_SEP + entry.virtualName;

		if (IsDirectory(entry.physicalName.c_str()))
		{
			entry.isDirectory = true;
			// is a directory, lets go inside
			entry.size = ScanDirectoryTree(entry.physicalName, entry);
			foundEntries += (u32)entry.size;
		}
		else
		{ // is a file 
			entry.isDirectory = false;
			entry.size = GetSize(entry.physicalName.c_str());
		}
		++foundEntries;
		// Push into the tree
		parentEntry.children.push_back(entry);		
#ifdef _WIN32 
	} while (FindNextFile(hFind, &ffd) != 0);
	FindClose(hFind);
#else
	}
	closedir(dirp);
#endif
	// Return number of entries found.
	return foundEntries;
}
开发者ID:john-peterson,项目名称:dolphin-emu,代码行数:69,代码来源:FileUtil.cpp


示例14: EditFile

/*
 * EditFile - read a file into text
 */
vi_rc EditFile( char *name, bool dammit )
{
    char        *fn, **list, *currfn;
    int         i, cnt, ocnt;
    int         j, len;
    window_id   wn = NO_WINDOW;
    char        cdir[FILENAME_MAX];
    info        *ci, *il;
    bool        usedir = false;
    char        mask[FILENAME_MAX];
    bool        reset_dir;
    int         index;
    char        *altname = NULL;
    vi_rc       rc;

    fn = MemAlloc( FILENAME_MAX );

    /*
     * get file name
     */
    strcpy( cdir, CurrentDirectory );
    reset_dir = false;
    RemoveLeadingSpaces( name );
    if( name[0] == '$' ) {
        EliminateFirstN( name, 1 );
        usedir = true;
    }
    fn[0] = 0;
//    if( NextWord1( name, fn ) <= 0 )
    if( GetStringWithPossibleQuote2( name, fn, false ) != ERR_NO_ERR ) {
        usedir = true;
        mask[0] = '*';
        mask[1] = 0;
    }
    if( usedir ) {
        if( EditFlags.ExMode ) {
            MemFree( fn );
            return( ERR_INVALID_IN_EX_MODE );
        }
        len = strlen( fn );
        if( len > 0 ) {
            i = len - 1;
            strcpy( mask, fn );
            cnt = 0;
            while( i >= 0 ) {
                if( fn[i] == FILE_SEP ) {
                    for( j = i + 1; j <= len; j++ ) {
                        mask[j - (i + 1)] = fn[j];
                    }
                    cnt = i;
                    break;
                }
                i--;
            }
            fn[cnt] = 0;
        }
        if( fn[0] != 0 ) {
            rc = SelectFileOpen( fn, &fn, mask, true );
        } else {
#ifdef __WIN__
            if( name[0] == '\0' ) {
                altname = MemAlloc( 1000 );
                rc = SelectFileOpen( CurrentDirectory, &altname, mask, true );
                NextWord1( altname, fn );  // if multiple, kill path
                if( isMultipleFiles( altname ) ) {
                    NextWord1( altname, fn ); // get 1st name
                }
            } else {
                rc = SelectFileOpen( CurrentDirectory, &fn, mask, true );
            }
#else
            rc = SelectFileOpen( CurrentDirectory, &fn, mask, true );
#endif
        }
        if( altname ) {
            name = altname;
        }

        if( rc != ERR_NO_ERR || fn[0] == 0 ) {
            MemFree( fn );
            SetCWD( cdir );
            return( rc );
        }
    }

    /*
     * loop through all files
     */
    rc = ERR_NO_ERR;
    EditFlags.WatchForBreak = true;
#ifdef __WIN__
    ToggleHourglass( true );
#endif
    do {
        if( IsDirectory( fn ) ) {
            if( EditFlags.ExMode ) {
                rc = ERR_INVALID_IN_EX_MODE;
//.........这里部分代码省略.........
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:101,代码来源:cledit.c


示例15: TEST_NFILEUTILITIES

};





//============================================================================
//		Test case
//----------------------------------------------------------------------------
TEST_NFILEUTILITIES("Directories")
{


	// Perform the test
	theFile = NFileUtilities::GetDirectory(kNLocationHome);
	REQUIRE(theFile.IsDirectory());
	
	theFile = NFileUtilities::GetDirectory(kNLocationDesktop);
	REQUIRE(theFile.IsDirectory());
	
	theFile = NFileUtilities::GetDirectory(kNLocationPreferences);
	REQUIRE(theFile.IsDirectory());

	theFile = NFileUtilities::GetCWD();
	REQUIRE(theFile.IsDirectory());
}




开发者ID:x414e54,项目名称:nano,代码行数:26,代码来源:TFileUtilities.cpp


示例16: CompletePath

int CompletePath(const char *Base, char *Match, int Count) {
    char Name[MAXPATH];
    const char *dirp;
    char *namep;
    int len, count = 0;
    char cname[MAXPATH];
    int hascname = 0;
    RxMatchRes RM;
    FileFind *ff;
    FileInfo *fi;
    int rc;

    if (strcmp(Base, "") == 0) {
        if (ExpandPath(".", Name, sizeof(Name)) != 0) return -1;
    } else {
        if (ExpandPath(Base, Name, sizeof(Name)) != 0) return -1;
    }
//    SlashDir(Name);
    dirp = Name;
    namep = SepRChr(Name);
    if (namep == Name) {
        dirp = SSLASH;
        namep = Name + 1;
    } else if (namep == NULL) {
        namep = Name;
        dirp = SDOT;
    } else {
        *namep = 0;
        namep++;
    }

    len = strlen(namep);
    strcpy(Match, dirp);
    SlashDir(Match);
    cname[0] = 0;

    ff = new FileFind(dirp, "*",
                      ffDIRECTORY | ffHIDDEN
#if defined(USE_DIRENT)
                      | ffFAST // for SPEED
#endif
                     );
    if (ff == 0)
        return 0;
    rc = ff->FindFirst(&fi);
    while (rc == 0) {
        const char *dname = fi->Name();

        // filter out unwanted files
        if ((strcmp(dname, ".") != 0) &&
                (strcmp(dname, "..") != 0) &&
                (!CompletionFilter || RxExec(CompletionFilter, dname, strlen(dname), dname, &RM) != 1)) {
            if ((
#if defined(UNIX)
                        strncmp
#else // os2, nt, ...
                        strnicmp
#endif
                        (namep, dname, len) == 0)
                    && (dname[0] != '.' || namep[0] == '.')) {
                count++;
                if (Count == count) {
                    Slash(Match, 1);
                    strcat(Match, dname);
                    if (
#if defined(USE_DIRENT) // for SPEED
                        IsDirectory(Match)
#else
                        fi->Type() == fiDIRECTORY
#endif
                    )
                        Slash(Match, 1);
                } else if (Count == -1) {

                    if (!hascname) {
                        strcpy(cname, dname);
                        hascname = 1;
                    } else {
                        int o = 0;
#ifdef UNIX
                        while (cname[o] && dname[o] && (cname[o] == dname[o])) o++;
#endif
#if defined(OS2) || defined(NT)
                        while (cname[o] && dname[o] && (toupper(cname[o]) == toupper(dname[o]))) o++;
#endif
                        cname[o] = 0;
                    }
                }
            }
        }
        delete fi;
        rc = ff->FindNext(&fi);
    }
    delete ff;
    if (Count == -1) {
        Slash(Match, 1);
        strcat(Match, cname);
        if (count == 1) SlashDir(Match);
    }
    return count;
//.........这里部分代码省略.........
开发者ID:dmcbride,项目名称:efte,代码行数:101,代码来源:s_util.cpp


示例17: DVASSERT

FileList::FileList(const FilePath & filepath)
{
    DVASSERT(filepath.IsDirectoryPathname());
    
	path = filepath;

// Windows version
#if defined(__DAVAENGINE_WIN32__)

	//char tmp[_MAX_PATH];
	//_getcwd(tmp, _MAX_PATH);
	//Path = tmp;
	FilePath prevDir = FileSystem::Instance()->GetCurrentWorkingDirectory();
	BOOL res = SetCurrentDirectoryA(path.GetAbsolutePathname().c_str());

	if (res)
	{
		struct _finddata_t c_file;
		intptr_t hFile;
		FileEntry entry;

		if( (hFile = _findfirst( "*", &c_file )) != -1L )
		{
			do
			{
                //TODO: need to check for Win32
				entry.path = filepath + c_file.name;
				entry.name = c_file.name;
				entry.size = c_file.size;
				entry.isDirectory = (_A_SUBDIR & c_file.attrib) != 0;
				if(entry.isDirectory)
				{
					entry.path.MakeDirectoryPathname();
				}

				fileList.push_back(entry);
				//Logger::FrameworkDebug("filelist: %s %s", filepath.c_str(), entry.name.c_str());
			}
			while( _findnext( hFile, &c_file ) == 0 );

			_findclose( hFile );
		}
	}
	FileSystem::Instance()->SetCurrentWorkingDirectory(prevDir);

	//TODO add drives
	//entry.Name = "E:\\";
	//entry.isDirectory = true;
	//Files.push_back(entry);
#elif defined(__DAVAENGINE_MACOS__) || defined(__DAVAENGINE_IPHONE__) || defined (__DAVAENGINE_ANDROID__)
	struct dirent **namelist;
	FileEntry entry;

#if defined (__DAVAENGINE_ANDROID__)
	int32 n = scandir(path.GetAbsolutePathname().c_str(), &namelist, 0, alphasortAndroid);
#else //#if defined (__DAVAENGINE_ANDROID__)
	int32 n = scandir(path.GetAbsolutePathname().c_str(), &namelist, 0, alphasort);
#endif //#if defined (__DAVAENGINE_ANDROID__)    
    
	if (n >= 0)
	{
		while(n--)
		{
			entry.path = path + namelist[n]->d_name;
			entry.name = namelist[n]->d_name;
			entry.size = 0;
			entry.isDirectory = namelist[n]->d_type == DT_DIR;
            if(entry.isDirectory)
            {
                entry.path.MakeDirectoryPathname();
            }
			fileList.push_back(entry);
			free(namelist[n]);
		}
		free(namelist);
	}
#endif //PLATFORMS

	directoryCount = 0;
	fileCount = 0;
	for (int fi = 0; fi < GetCount(); ++fi)
	{
		if (IsDirectory(fi))
		{
			if (!IsNavigationDirectory(fi))
				directoryCount++;
		}else
			fileCount++;
	}
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:90,代码来源:FileList.cpp


示例18: recurse_compile

void recurse_compile( string basedir, vector<string>* files )
{
	long s_compiled, s_uptodate, s_errors;
	clock_t start, finish;

	if ( !IsDirectory( basedir.c_str() ) )
		return;

	s_compiled = s_uptodate = s_errors = 0;
	start = clock();
    for( DirList dl( basedir.c_str() ); !dl.at_end(); dl.next() )
    {
		string name = dl.name(), ext;
        if (name[0] == '.') continue;

		string::size_type pos = name.rfind(".");
		if (pos != string::npos)
			ext = name.substr(pos);

        try 
        {
			if ( pos != string::npos &&
				(!ext.compare(".src") ||
				 !ext.compare(".hsr") ||
				 (compilercfg.CompileAspPages && !ext.compare(".asp"))) )
			{
				s_compiled++;
				if (files==NULL)
				{
					if (compile_file( (basedir + name).c_str() ))
					{
						++summary.CompiledScripts;
					}
					else
					{
						++s_uptodate;
						++summary.UpToDateScripts;
					}
				}
				else
					files->push_back((basedir + name));
			}
            else
            {
                recurse_compile( basedir + name + "/", files );                
            }
        }
        catch( std::exception& )
        {
            ++summary.CompiledScripts;
            ++summary.ScriptsWithCompileErrors;
            if (!keep_building)
                throw;
			s_errors++;
        }
    }
	if (files==NULL)
		return;    
	finish = clock();

	if ( (!quiet || timing_quiet_override) && show_timing_details && s_compiled > 0 && files==NULL)
	{
		cout << "Compiled " << s_compiled << " script" << (s_compiled==1?"":"s")
			 << " in " << basedir
			 << " in " << (long)((finish-start)/CLOCKS_PER_SEC) << " second(s)" << endl;
		if ( s_uptodate > 0 )
			cout << "    " << s_uptodate << " script" << (s_uptodate==1?" was":"s were")
				 << " already up-to-date." << endl;
		if ( s_errors > 0 )
			cout << "    " << s_errors << " script" << (s_errors==1?"":"s")
				 << " had errors." << endl;
	}
}
开发者ID:alucardxlx,项目名称:polserver-zulu,代码行数:73,代码来源:ecompile.cpp


示例19: main


//.........这里部分代码省略.........
                        std::cerr << "There should be a positive number after -d option." << std::endl;
                        PrintInfo();
                        return 1;
                    }
                }
                break;
            case 'q':
                std::cout.setstate(std::ios::failbit);
                is_verbose = false;
                break;
            case 'v':
                std::cout.clear();
                is_verbose = true;
                break;
            case '-':
                if (STRCMP(argv[i] + j + 1, "fastmode") == 0)
                {
                    j += 7;
                    argv[i][j + 1] = 'f';
                }
                else if (STRCMP(argv[i] + j + 1, "iteration") == 0)
                {
                    j += 8;
                    argv[i][j + 1] = 'i';
                }
                else if (STRCMP(argv[i] + j + 1, "max_depth") == 0)
                {
                    j += 8;
                    argv[i][j + 1] = 'd';
                }
                else if (STRCMP(argv[i] + j + 1, "quiet") == 0)
                {
                    j += 4;
                    argv[i][j + 1] = 'q';
                }
                else if (STRCMP(argv[i] + j + 1, "verbose") == 0)
                {
                    j += 6;
                    argv[i][j + 1] = 'v';
                }
                else if (STRCMP(argv[i] + j + 1, "keep-exif") == 0)
                {
                    j += 9;
                    Jpeg::keep_exif = true;
                }
                else
                {
#ifdef _WIN32
                    char mbs[64] = { 0 };
                    WideCharToMultiByte(CP_ACP, 0, argv[i] + j + 1, -1, mbs, sizeof(mbs) - 1, nullptr, nullptr);
                    std::cerr << "Unknown option: " << mbs << std::endl;
#else
                    std::cerr << "Unknown option: " << argv[i] + j + 1 << std::endl;
#endif // _WIN32
                    PrintInfo();
                    return 1;
                }
                break;
            default:
                std::cerr << "Unknown option: " << (char)argv[i][j] << std::endl;
                PrintInfo();
                return 1;
            }
        }
        i += num_optargs;
    }

    if (i == argc)
    {
        std::cerr << "No file path provided." << std::endl;
        PrintInfo();
        return 1;
    }


    std::cout << std::fixed;
    std::cout.precision(2);

    // support multiple input file
    do
    {
        if (IsDirectory(argv[i]))
        {
            // directory
            TraverseDirectory(argv[i], ProcessFile);
        }
        else
        {
            // file
            ProcessFile(argv[i]);
        }

    }
    while (++i < argc);


    PauseIfNotTerminal();

    return 0;
}
开发者ID:MohammedRaji,项目名称:Leanify,代码行数:101,代码来源:main.cpp


示例20: ATLASSERT

CString CTSVNPath::GetFilename() const
{
    ATLASSERT(!IsDirectory());
    return GetFileOrDirectoryName();
}
开发者ID:yuexiaoyun,项目名称:tortoisesvn,代码行数:5,代码来源:TSVNPath.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IsDisabled函数代码示例发布时间:2022-05-30
下一篇:
C++ IsDir函数代码示例发布时间: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