~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/zip_exporter.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 17:11:25 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201171125-5e1f0970246c4925
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
from bzrlib.trace import mutter
 
22
from bzrlib.osutils import pathjoin
22
23
import zipfile
23
24
 
24
25
def zip_exporter(tree, dest, root):
43
44
            file_id = ie.file_id
44
45
            mutter("  export {%s} kind %s to %s", file_id, ie.kind, dest)
45
46
 
 
47
            # This may not require pathjoin, since we are doing
 
48
            # an export, but for consistency we will use it
46
49
            if ie.kind == "file": 
47
50
                zinfo = zipfile.ZipInfo(
48
 
                            filename=str(os.path.join(root, dp)),
 
51
                            filename=str(pathjoin(root, dp)),
49
52
                            date_time=now)
50
53
                zinfo.compress_type = compression
51
54
                zipf.writestr(zinfo, tree.get_file_text(file_id))
52
55
            elif ie.kind == "directory":
53
56
                zinfo = zipfile.ZipInfo(
54
 
                            filename=str(os.path.join(root, dp)+os.sep),
 
57
                            filename=str(pathjoin(root, dp)+os.sep),
55
58
                            date_time=now)
56
59
                zinfo.compress_type = compression
57
60
                zipf.writestr(zinfo,'')
58
61
            elif ie.kind == "symlink":
59
62
                zinfo = zipfile.ZipInfo(
60
 
                            filename=str(os.path.join(root, dp+".lnk")),
 
63
                            filename=str(pathjoin(root, dp+".lnk")),
61
64
                            date_time=now)
62
65
                zinfo.compress_type = compression
63
66
                zipf.writestr(zinfo, ie.symlink_target)