/** * @brief Checks for duplicate files * @param[in] file The file path to check whether there is an identical file * @param[in] wildcard The wildcard to specify which files should be checked * @return @c false if no duplicate was found, @c true otherwise */ bool Com_CheckDuplicateFile (const char* file, const char* wildcard) { const char* md5 = Com_MD5File(file); const char* filename; bool match = false; while ((filename = FS_NextFileFromFileList(wildcard)) != nullptr) { const char* md5Other = Com_MD5File(filename); if (Q_streq(md5, md5Other)) { match = true; break; } } FS_NextFileFromFileList(nullptr); return match; }
void CL_CheckAutoUpdate(void) { char info[MAX_INFO_STRING]; #ifndef FEATURE_AUTOUPDATE return; #endif if (!com_autoupdate->integer) { Com_DPrintf("Updater is disabled by com_autoupdate 0.\n"); return; } // Only check once per session if (autoupdate.updateChecked) { return; } // Resolve update server Com_Printf("Updater: resolving %s... ", UPDATE_SERVER_NAME); if (!NET_StringToAdr(va("%s:%i", UPDATE_SERVER_NAME, PORT_UPDATE), &autoupdate.autoupdateServer, NA_UNSPEC)) { Com_Printf("couldn't resolve address\n"); autoupdate.updateChecked = qtrue; return; } else { Com_Printf("resolved to %s\n", NET_AdrToString(autoupdate.autoupdateServer)); } info[0] = 0; Info_SetValueForKey(info, "version", ETLEGACY_VERSION_SHORT); Info_SetValueForKey(info, "platform", CPUSTRING); Info_SetValueForKey(info, va("etl_bin_%s.pk3", ETLEGACY_VERSION_SHORT), Com_MD5File(va("legacy/etl_bin_%s.pk3", ETLEGACY_VERSION_SHORT), 0, NULL, 0)); Info_SetValueForKey(info, va("pak3_%s.pk3", ETLEGACY_VERSION_SHORT), Com_MD5File(va("legacy/pak3_%s.pk3", ETLEGACY_VERSION_SHORT), 0, NULL, 0)); NET_OutOfBandPrint(NS_CLIENT, autoupdate.autoupdateServer, "getUpdateInfo \"%s\"", info); autoupdate.updateChecked = qtrue; }