equal
deleted
inserted
replaced
1150 return a function that opens files relative to base |
1150 return a function that opens files relative to base |
1151 |
1151 |
1152 this function is used to hide the details of COW semantics and |
1152 this function is used to hide the details of COW semantics and |
1153 remote file access from higher level code. |
1153 remote file access from higher level code. |
1154 """ |
1154 """ |
1155 p = base |
|
1156 audit_p = audit |
|
1157 |
|
1158 def mktempcopy(name, emptyok=False): |
1155 def mktempcopy(name, emptyok=False): |
1159 d, fn = os.path.split(name) |
1156 d, fn = os.path.split(name) |
1160 fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) |
1157 fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) |
1161 os.close(fd) |
1158 os.close(fd) |
1162 # Temporary files are created with mode 0600, which is usually not |
1159 # Temporary files are created with mode 0600, which is usually not |
1207 os.unlink(self.temp) |
1204 os.unlink(self.temp) |
1208 except: pass |
1205 except: pass |
1209 posixfile.close(self) |
1206 posixfile.close(self) |
1210 |
1207 |
1211 def o(path, mode="r", text=False, atomictemp=False): |
1208 def o(path, mode="r", text=False, atomictemp=False): |
1212 if audit_p: |
1209 if audit: |
1213 audit_path(path) |
1210 audit_path(path) |
1214 f = os.path.join(p, path) |
1211 f = os.path.join(base, path) |
1215 |
1212 |
1216 if not text: |
1213 if not text: |
1217 mode += "b" # for that other OS |
1214 mode += "b" # for that other OS |
1218 |
1215 |
1219 if mode[0] != "r": |
1216 if mode[0] != "r": |