本文整理汇总了C++中CConfig::FindDataFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfig::FindDataFile方法的具体用法?C++ CConfig::FindDataFile怎么用?C++ CConfig::FindDataFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfig
的用法示例。
在下文中一共展示了CConfig::FindDataFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryLoadArcFile
bool TryLoadArcFile(const char *arcName, int drive)
{
C_File fl;
char res[MAX_PATH];
char tmp[MAX_PATH], str[MAX_FNAME];
char files[MAX_FILES][MAX_FNAME];
int filesCount;
string plugin_fn;
strcpy(tmp, C_DirWork::ExtractExt(arcName));
if (!strlen(tmp)) {
return false;
}
StrToLower(tmp);
plugin_fn = config.FindDataFile("arc", tmp);
if (plugin_fn.empty()) {
return false;
}
sprintf(tmp, "%s list \"%s\" %s/files.txt", plugin_fn.c_str(), arcName, tempFolderName);
if (system(tmp) == -1) DEBUG_MESSAGE("system failed");
sprintf(tmp, "%s/files.txt", tempFolderName);
if (!C_File::FileExists(tmp)) return true; // "true" here means ONLY that the file is an archive
fl.Read(tmp);
for (filesCount = 0; !fl.Eof(); )
{
fl.GetS(str, sizeof(str));
if (strcmp(str, "")) strcpy(files[filesCount++], str);
}
unlink(tmp);
if (!filesCount) return true; // "true" here means ONLY that the file is an archive
// currently load only first file
sprintf(tmp, "%s extract \"%s\" \"%s\" %s", plugin_fn.c_str(), arcName, files[0], tempFolderName);
if (system(tmp) == -1) DEBUG_MESSAGE("system failed");
strcpy(tmp, C_DirWork::ExtractFileName(files[0]));
// TODO: check if lresult strlen > sizeof(res)
sprintf(res, "%s/%s", tempFolderName, tmp);
LoadNormalFile(res, drive, arcName);
unlink(res);
return true; // "true" here means ONLY that the file is an archive
}