本文整理汇总了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;
}
示例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;
};
示例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;
}
示例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);
}
示例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;
}
示例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()));
}
示例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;
}
示例8: GetMode
int wxTarEntry::GetMode() const
{
if (m_IsModeSet || !IsDir())
return m_Mode;
else
return m_Mode | 0111;
}
示例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;
}
示例10: CreateDirRecursive
bool CreateDirRecursive(LPCTSTR path)
{
bool ret = IsDir(path) || CreateDirectory(path, nullptr);
if (!ret) {
ret = CreateDirRecursive(DirName(path)) && CreateDirectory(path, nullptr);
}
return ret;
}
示例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);
}
示例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);
};
示例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 ) ;
}
}
示例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
}
示例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;
}