-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
While debugging, I noticed something that seems like a bug.
if you pass in false in the recurse parameter to the ZipFile.AddOrUpdateImpl function, files in the base folder will not be added to the zip file.
Current implementation (partial):
String[] filenames = Directory.GetFiles(directoryName);
if (recurse)
{
// add the files:
foreach (String filename in filenames)
{
if (_addOperationCanceled) break;
if (action == AddOrUpdateAction.AddOnly)
AddFile(filename, dirForEntries);
else
UpdateFile(filename, dirForEntries);
}
if (!_addOperationCanceled)
{
// add the subdirectories:
String[] dirnames = Directory.GetDirectories(directoryName);
foreach (String dir in dirnames)
{
// workitem 8617: Optionally traverse reparse points
FileAttributes fileAttrs = System.IO.File.GetAttributes(dir);
if (this.AddDirectoryWillTraverseReparsePoints
|| ((fileAttrs & FileAttributes.ReparsePoint) == 0)
)
AddOrUpdateDirectoryImpl(dir, rootDirectoryPathInArchive, action, recurse, level + 1);
}
}
}
I think the implementation of this part should be:
String[] filenames = Directory.GetFiles(directoryName);
// add the files:
foreach (String filename in filenames)
{
if (_addOperationCanceled) break;
if (action == AddOrUpdateAction.AddOnly)
AddFile(filename, dirForEntries);
else
UpdateFile(filename, dirForEntries);
}
if (recurse && !_addOperationCanceled)
{
// add the subdirectories:
String[] dirnames = Directory.GetDirectories(directoryName);
foreach (String dir in dirnames)
{
// workitem 8617: Optionally traverse reparse points
FileAttributes fileAttrs = System.IO.File.GetAttributes(dir);
if (this.AddDirectoryWillTraverseReparsePoints
|| ((fileAttrs & FileAttributes.ReparsePoint) == 0)
)
AddOrUpdateDirectoryImpl(dir, rootDirectoryPathInArchive, action, recurse, level + 1);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels