| 131 | } |
| 132 | |
| 133 | void putFile(const Path& path, const Bytes& bytes) override |
| 134 | { |
| 135 | HfsMount m(this); |
| 136 | if (path.size() == 0) |
| 137 | throw BadPathException(); |
| 138 | |
| 139 | AppleSingle a; |
| 140 | try |
| 141 | { |
| 142 | a.parse(bytes); |
| 143 | } |
| 144 | catch (const InvalidFileException& e) |
| 145 | { |
| 146 | throw UnimplementedFilesystemException( |
| 147 | "you can only write valid AppleSingle encoded files"); |
| 148 | } |
| 149 | |
| 150 | auto pathstr = ":" + path.to_str(":"); |
| 151 | hfs_delete(_vol, pathstr.c_str()); |
| 152 | HfsFile file(hfs_create(_vol, |
| 153 | pathstr.c_str(), |
| 154 | (const char*)a.type.cbegin(), |
| 155 | (const char*)a.creator.cbegin())); |
| 156 | if (!file) |
| 157 | throwError(); |
| 158 | |
| 159 | hfs_setfork(file, 0); |
| 160 | writeBytes(file, a.data); |
| 161 | hfs_setfork(file, 1); |
| 162 | writeBytes(file, a.rsrc); |
| 163 | } |
| 164 | |
| 165 | void deleteFile(const Path& path) override |
| 166 | { |
nothing calls this directly
no test coverage detected