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 }