Show More
@@ -149,19 +149,14 b' class fileit:' | |||
|
149 | 149 | if prefix: |
|
150 | 150 | raise util.Abort(_('cannot give prefix when archiving to files')) |
|
151 | 151 | self.basedir = name |
|
152 | self.dirs = {} | |
|
153 | self.oflags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY | | |
|
154 | getattr(os, 'O_BINARY', 0) | | |
|
155 | getattr(os, 'O_NOFOLLOW', 0)) | |
|
152 | self.opener = util.opener(self.basedir) | |
|
156 | 153 | |
|
157 | 154 | def addfile(self, name, mode, data): |
|
155 | f = self.opener(name, "w", atomictemp=True) | |
|
156 | f.write(data) | |
|
157 | f.rename() | |
|
158 | 158 | destfile = os.path.join(self.basedir, name) |
|
159 |
|
|
|
160 | if destdir not in self.dirs: | |
|
161 | if not os.path.isdir(destdir): | |
|
162 | os.makedirs(destdir) | |
|
163 | self.dirs[destdir] = 1 | |
|
164 | os.fdopen(os.open(destfile, self.oflags, mode), 'wb').write(data) | |
|
159 | os.chmod(destfile, mode) | |
|
165 | 160 | |
|
166 | 161 | def done(self): |
|
167 | 162 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now