|
Post by Luis Cobian on Dec 1, 2004 7:10:00 GMT -5
Hello
While trying to modify the default nam,e of the parts using OnFileNameForSplitPart I found a problem. If the name of the archive contains several dots, like say:
Cobian Backup 6.9.121.zip then the file name passed to OnFileNameForSplitPart is only Cobian Backup 6. I have tracked the problem to the unit VCLUnZip, method SetZipName, lines 888-889
fnamepos := fnamepos + Pos('.',Copy(FZipName,fnamepos,Length(FZipName)-fnamepos))-1; FZipNameNoExtension := LeftStr(FZipName,fnamepos-1);
When you get fnamepos you are just finding the first dot, thus loosing a whole part of the file name, wronglu qualified as an extension.
There seems to be 2 solutions to this: using ChangeFileExt(FZipName,'') which seems to wrok right, or finding the position of the dot backwards:
for i:=Length(FzipName) downto 1 do begin if FZipName='.' then begin fdotposition:=i; break; end; end;
etc.
Regards
|
|
|
Post by Kevin on Dec 1, 2004 11:23:24 GMT -5
Actually here is the best fix. Change this line
fnamepos := fnamepos + Pos('.',Copy(FZipName,fnamepos,Length(FZipName)-fnamepos))-1;
to the following:
fnamepos := fnamepos + LastDelimeter('.',Copy(FZipName,fnamepos,Length(FZipName)-fnamepos))-1;
Kevin
|
|