Browse Source

* Disable parts of commit 13378 for windows, since it blocks extracting zips with Unix lineseparators (like Open Office files, even when generated on Windows)
* Minor tweak to demo

git-svn-id: trunk@15025 -

marco 15 years ago
parent
commit
0f9f3600c5
2 changed files with 10 additions and 2 deletions
  1. 1 1
      packages/paszlib/examples/extractodt.pas
  2. 9 1
      packages/paszlib/src/zipper.pp

+ 1 - 1
packages/paszlib/examples/extractodt.pas

@@ -20,7 +20,7 @@ begin
   FileName:=paramstr(1);
   FileName:=paramstr(1);
   if not fileexists(FileName) then
   if not fileexists(FileName) then
     Usage;
     Usage;
-  edir:=extractfilename(filename)+'extractiondir';
+  edir:=extractfilename(filename)+'.extractiondir';
   mkdir(edir);
   mkdir(edir);
   unzipper:=TUnzipper.create;
   unzipper:=TUnzipper.create;
   unzipper.FileName:=FileName;
   unzipper.FileName:=FileName;

+ 9 - 1
packages/paszlib/src/zipper.pp

@@ -1561,9 +1561,15 @@ Begin
     for Windows compatibility: it allows both '/' and '\'
     for Windows compatibility: it allows both '/' and '\'
     as directory separator. We don't want that behaviour
     as directory separator. We don't want that behaviour
     here, since 'abc\' is a valid file name under Unix.
     here, since 'abc\' is a valid file name under Unix.
+	
+	(mantis 15836) On the other hand, many archives on 
+	 windows have '/' as pathseparator, even Windows 
+	 generated .odt files. So we disable this for windows.
   }
   }
   OldDirectorySeparators:=AllowDirectorySeparators;
   OldDirectorySeparators:=AllowDirectorySeparators;
+  {$ifndef Windows}
   AllowDirectorySeparators:=[DirectorySeparator];
   AllowDirectorySeparators:=[DirectorySeparator];
+  {$endif}
   Path:=ExtractFilePath(OutFileName);
   Path:=ExtractFilePath(OutFileName);
   OutStream:=Nil;
   OutStream:=Nil;
   If Assigned(FOnCreateStream) then
   If Assigned(FOnCreateStream) then
@@ -1576,10 +1582,12 @@ Begin
     AllowDirectorySeparators:=OldDirectorySeparators;
     AllowDirectorySeparators:=OldDirectorySeparators;
     OutStream:=TFileStream.Create(OutFileName,fmCreate);
     OutStream:=TFileStream.Create(OutFileName,fmCreate);
     end;
     end;
-
+	
+  AllowDirectorySeparators:=OldDirectorySeparators;
   Result:=True;
   Result:=True;
   If Assigned(FOnStartFile) then
   If Assigned(FOnStartFile) then
     FOnStartFile(Self,OutFileName);
     FOnStartFile(Self,OutFileName);
+	
 End;
 End;