Changeset 3765
- Timestamp:
- 07/20/08 08:37:32 (4 months ago)
- Files:
-
- trunk/tango/io/compress/Zip.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tango/io/compress/Zip.d
r3729 r3765 41 41 42 42 import Path = tango.io.Path; 43 import PathUtil = tango.util.PathUtil; 43 44 import Integer = tango.text.convert.Integer; 44 45 … … 1331 1332 char[] file_name) 1332 1333 { 1334 auto f_name = PathUtil.normalize(file_name); 1335 auto p = Path.parse(f_name); 1336 1333 1337 // Compute Zip version 1334 1338 if( data.extract_version == data.extract_version.max ) 1335 1339 { 1340 1336 1341 ushort zipver = 10; 1337 1342 void minver(ushort v) { zipver = v>zipver ? v : zipver; } … … 1348 1353 1349 1354 // File is a folder 1350 if( file_name.length > 0 && file_name[$-1] == '/' 1351 || file_name[$-1] == '\\' ) 1355 if( f_name.length > 0 && f_name[$-1] == '/' ) 1352 1356 // Is a directory, not a real file 1353 1357 minver(20); … … 1369 1373 LocalFileHeader header; 1370 1374 header.data = data; 1371 header.file_name = file_name; 1375 if (p.isAbsolute) 1376 f_name = f_name[p.root.length+1..$]; 1377 header.file_name = Path.native(f_name); 1372 1378 1373 1379 // Write out the header and the filename … … 1381 1387 Entry entry; 1382 1388 entry.data.fromLocal(header.data); 1383 entry.filename = file_name;1389 entry.filename = header.file_name; 1384 1390 entry.header_position = header_pos; 1385 1391 entry.data.relative_offset_of_local_header = cast(int) header_pos; … … 1779 1785 { 1780 1786 // Skip directories 1781 if( entry.info.name[$-1] == '/' ) continue; 1787 if( entry.info.name[$-1] == '/' || 1788 entry.info.name[$-1] == '\\') continue; 1782 1789 1783 1790 auto path = Path.join(dest, entry.info.name); 1791 path = Path.native(path); 1784 1792 scope fout = new FileConduit(path, FileConduit.WriteCreate); 1785 1793 fout.output.copy(entry.open);












