2025-07-17 08:21 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000633Spring engineGeneralpublic2007-09-24 07:14
Reporterredstar 
Assigned ToILMTitan 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000633: [PATCH] Unitsync GetArchivePath()
DescriptionI dont have commit access to archivescanner.h/cpp iirc so here's the change in patch form.

Given a specified archive it'll return the path to that archive. Lobbies could then manage archives or hash them using other hash algorithms or manually open and search them.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • diff file icon GetArchivePath.diff (2,394 bytes) 2007-09-14 11:43 -
    Index: rts/System/FileSystem/ArchiveScanner.cpp
    ===================================================================
    --- rts/System/FileSystem/ArchiveScanner.cpp	(revision 4371)
    +++ rts/System/FileSystem/ArchiveScanner.cpp	(working copy)
    @@ -536,6 +536,27 @@
     	return aii->second.checksum;
     }
     
    +std::string CArchiveScanner::GetArchivePath(const string& name)
    +{
    +	string lcname = name;
    +
    +	// Strip path-info if present
    +	if (lcname.find_last_of('\\') != string::npos)
    +		lcname = lcname.substr(lcname.find_last_of('\\') + 1);
    +	if (lcname.find_last_of('/') != string::npos)
    +		lcname = lcname.substr(lcname.find_last_of('/') + 1);
    +
    +	StringToLowerInPlace(lcname);
    +
    +	map<string, ArchiveInfo>::iterator aii = archiveInfo.find(lcname);
    +	if (aii == archiveInfo.end()) {
    +		logOutput.Print("GetArchivePath: Could not find archive \"%s\"", name.c_str());
    +		return 0;
    +	}
    +
    +	return aii->second.path;
    +}
    +
     /** Get checksum of all required archives depending on selected mod. */
     unsigned int CArchiveScanner::GetModChecksum(const string& root)
     {
    Index: rts/System/FileSystem/ArchiveScanner.h
    ===================================================================
    --- rts/System/FileSystem/ArchiveScanner.h	(revision 4371)
    +++ rts/System/FileSystem/ArchiveScanner.h	(working copy)
    @@ -49,6 +49,7 @@
     	vector<string> GetMaps();
     	vector<string> GetArchivesForMap(const string& mapName);
     	unsigned int GetArchiveChecksum(const string& name);
    +	std::string GetArchivePath(const string& name);
     	unsigned int GetModChecksum(const string& root);
     	unsigned int GetMapChecksum(const string& mapName);
     	void CheckMod(const string& root, unsigned checksum); // these throw a content_error if checksum doesn't match
    Index: tools/unitsync/unitsync.cpp
    ===================================================================
    --- tools/unitsync/unitsync.cpp	(revision 4371)
    +++ tools/unitsync/unitsync.cpp	(working copy)
    @@ -280,6 +280,13 @@
     	return archiveScanner->GetArchiveChecksum(arname);
     }
     
    +DLL_EXPORT const char* __stdcall GetArchivePath(const char* arname)
    +{
    +	ASSERT(archiveScanner && hpiHandler, "Call InitArchiveScanner before GetArchivePath.");
    +	ASSERT(arname && *arname, "Don't pass a NULL pointer or an empty string to GetArchivePath.");
    +	return archiveScanner->GetArchivePath(arname).c_str();
    +}
    +
     // Updated on every call to getmapcount
     static vector<string> mapNames;
     
    
    diff file icon GetArchivePath.diff (2,394 bytes) 2007-09-14 11:43 +

-Relationships
+Relationships

-Notes

~0001300

ILMTitan (reporter)

Committed in revision 4451.
+Notes

-Issue History
Date Modified Username Field Change
2007-09-14 11:43 redstar New Issue
2007-09-14 11:43 redstar File Added: GetArchivePath.diff
2007-09-24 07:14 ILMTitan Status new => resolved
2007-09-24 07:14 ILMTitan Resolution open => fixed
2007-09-24 07:14 ILMTitan Assigned To => ILMTitan
2007-09-24 07:14 ILMTitan Note Added: 0001300
+Issue History