本文整理汇总了C++中DOS_DTA::GetDirID方法的典型用法代码示例。如果您正苦于以下问题:C++ DOS_DTA::GetDirID方法的具体用法?C++ DOS_DTA::GetDirID怎么用?C++ DOS_DTA::GetDirID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOS_DTA
的用法示例。
在下文中一共展示了DOS_DTA::GetDirID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindNext
bool localDrive::FindNext(DOS_DTA & dta) {
char * dir_ent;
struct stat stat_block;
char full_name[CROSS_LEN];
char dir_entcopy[CROSS_LEN];
Bit8u srch_attr;char srch_pattern[DOS_NAMELENGTH_ASCII];
Bit8u find_attr;
dta.GetSearchParams(srch_attr,srch_pattern);
Bit16u id = dta.GetDirID();
again:
if (!dirCache.FindNext(id,dir_ent)) {
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
if(!WildFileCmp(dir_ent,srch_pattern)) goto again;
strcpy(full_name,srchInfo[id].srch_dir);
strcat(full_name,dir_ent);
//GetExpandName might indirectly destroy dir_ent (by caching in a new directory
//and due to its design dir_ent might be lost.)
//Copying dir_ent first
strcpy(dir_entcopy,dir_ent);
if (stat(dirCache.GetExpandName(full_name),&stat_block)!=0) {
goto again;//No symlinks and such
}
if(stat_block.st_mode & S_IFDIR) find_attr=DOS_ATTR_DIRECTORY;
else find_attr=DOS_ATTR_ARCHIVE;
if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;
/*file is okay, setup everything to be copied in DTA Block */
char find_name[DOS_NAMELENGTH_ASCII];Bit16u find_date,find_time;Bit32u find_size;
if(strlen(dir_entcopy)<DOS_NAMELENGTH_ASCII){
strcpy(find_name,dir_entcopy);
upcase(find_name);
}
find_size=(Bit32u) stat_block.st_size;
struct tm *time;
if((time=localtime(&stat_block.st_mtime))!=0){
find_date=DOS_PackDate((Bit16u)(time->tm_year+1900),(Bit16u)(time->tm_mon+1),(Bit16u)time->tm_mday);
find_time=DOS_PackTime((Bit16u)time->tm_hour,(Bit16u)time->tm_min,(Bit16u)time->tm_sec);
} else {
find_time=6;
find_date=4;
}
dta.SetResult(find_name,find_size,find_date,find_time,find_attr);
return true;
}
示例2: FindNext
bool physfsDrive::FindNext(DOS_DTA & dta) {
char * dir_ent;
char full_name[CROSS_LEN];
Bit8u srch_attr;char srch_pattern[DOS_NAMELENGTH_ASCII];
Bit8u find_attr;
dta.GetSearchParams(srch_attr,srch_pattern);
Bitu id = dta.GetDirID();
again:
if (!dirCache.FindNext(id,dir_ent)) {
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
if(!WildFileCmp(dir_ent,srch_pattern)) goto again;
char find_name[DOS_NAMELENGTH_ASCII];Bit16u find_date,find_time;Bit32u find_size;
if(strlen(dir_ent)<DOS_NAMELENGTH_ASCII){
strcpy(find_name,dir_ent);
upcase(find_name);
}
strcpy(full_name,srchInfo[id].srch_dir);
strcat(full_name,dir_ent);
dirCache.ExpandName(full_name);
normalize(full_name,basedir);
if (PHYSFS_isDirectory(full_name)) find_attr=DOS_ATTR_DIRECTORY|DOS_ATTR_ARCHIVE;
else find_attr=DOS_ATTR_ARCHIVE;
if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;
/*file is okay, setup everything to be copied in DTA Block */
find_size=(Bit32u)PHYSFS_fileLength(full_name);
time_t mytime = (time_t)PHYSFS_getLastModTime(full_name);
struct tm *time;
if((time=localtime(&mytime))!=0){
find_date=DOS_PackDate((Bit16u)(time->tm_year+1900),(Bit16u)(time->tm_mon+1),(Bit16u)time->tm_mday);
find_time=DOS_PackTime((Bit16u)time->tm_hour,(Bit16u)time->tm_min,(Bit16u)time->tm_sec);
} else {
find_time=6;
find_date=4;
}
dta.SetResult(find_name,find_size,find_date,find_time,find_attr);
return true;
}
示例3: FindNext
bool isoDrive::FindNext(DOS_DTA &dta) {
Bit8u attr;
char pattern[DOS_NAMELENGTH_ASCII];
dta.GetSearchParams(attr, pattern);
int dirIterator = dta.GetDirID();
bool isRoot = dirIterators[dirIterator].root;
isoDirEntry de;
while (GetNextDirEntry(dirIterator, &de)) {
Bit8u findAttr = 0;
if (IS_DIR(FLAGS1)) findAttr |= DOS_ATTR_DIRECTORY;
else findAttr |= DOS_ATTR_ARCHIVE;
if (IS_HIDDEN(FLAGS1)) findAttr |= DOS_ATTR_HIDDEN;
if (!IS_ASSOC(FLAGS1) && !(isRoot && de.ident[0]=='.') && WildFileCmp((char*)de.ident, pattern)
&& !(~attr & findAttr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM))) {
/* file is okay, setup everything to be copied in DTA Block */
char findName[DOS_NAMELENGTH_ASCII];
findName[0] = 0;
if(strlen((char*)de.ident) < DOS_NAMELENGTH_ASCII) {
strcpy(findName, (char*)de.ident);
upcase(findName);
}
Bit32u findSize = DATA_LENGTH(de);
Bit16u findDate = DOS_PackDate(1900 + de.dateYear, de.dateMonth, de.dateDay);
Bit16u findTime = DOS_PackTime(de.timeHour, de.timeMin, de.timeSec);
dta.SetResult(findName, findSize, findDate, findTime, findAttr);
return true;
}
}
// after searching the directory, free the iterator
FreeDirIterator(dirIterator);
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}