Changeset - r28543:19a8f7f35302
[Not reviewed]
master
0 1 0
Patric Stout - 11 months ago 2024-01-21 18:06:58
truebrain@openttd.org
Fix #6377: two tarballs with the same folder in them were considered as one (#11855)
1 file changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/fileio.cpp
Show inline comments
 
@@ -529,6 +529,9 @@ bool TarScanner::AddFile(const std::stri
 

	
 
	_tar_list[this->subdir][filename] = std::string{};
 

	
 
	std::string filename_base = std::filesystem::path(filename).filename().string();
 
	SimplifyFileName(filename_base);
 

	
 
	TarLinkList links; ///< Temporary list to collect links
 

	
 
	TarHeader th;
 
@@ -583,7 +586,7 @@ bool TarScanner::AddFile(const std::stri
 
				SimplifyFileName(name);
 

	
 
				Debug(misc, 6, "Found file in tar: {} ({} bytes, {} offset)", name, skip, pos);
 
				if (_tar_filelist[this->subdir].insert(TarFileList::value_type(name, entry)).second) num++;
 
				if (_tar_filelist[this->subdir].insert(TarFileList::value_type(filename_base + PATHSEPCHAR + name, entry)).second) num++;
 

	
 
				break;
 
			}
 
@@ -615,7 +618,7 @@ bool TarScanner::AddFile(const std::stri
 

	
 
				/* Store links in temporary list */
 
				Debug(misc, 6, "Found link in tar: {} -> {}", name, dest);
 
				links.insert(TarLinkList::value_type(name, dest));
 
				links.insert(TarLinkList::value_type(filename_base + PATHSEPCHAR + name, filename_base + PATHSEPCHAR + dest));
 

	
 
				break;
 
			}
0 comments (0 inline, 0 general)