(self, inner_path, content)
| 224 | |
| 225 | # Write content to file |
| 226 | def write(self, inner_path, content): |
| 227 | file_path = self.getPath(inner_path) |
| 228 | # Create dir if not exist |
| 229 | file_dir = os.path.dirname(file_path) |
| 230 | if not os.path.isdir(file_dir): |
| 231 | os.makedirs(file_dir) |
| 232 | # Write file |
| 233 | if hasattr(content, 'read'): # File-like object |
| 234 | with open(file_path, "wb") as file: |
| 235 | shutil.copyfileobj(content, file) # Write buff to disk |
| 236 | else: # Simple string |
| 237 | if inner_path == "content.json" and os.path.isfile(file_path): |
| 238 | helper.atomicWrite(file_path, content) |
| 239 | else: |
| 240 | with open(file_path, "wb") as file: |
| 241 | file.write(content) |
| 242 | del content |
| 243 | self.onUpdated(inner_path) |
| 244 | |
| 245 | # Remove file from filesystem |
| 246 | def delete(self, inner_path): |
no test coverage detected