| 208 | |
| 209 | /// |
| 210 | SaveGame(Allocator &a, const char *save_dir) |
| 211 | : _allocator(&a) |
| 212 | , _filesystem(a) |
| 213 | , _requests_queue(a) |
| 214 | , _next_token(0) |
| 215 | , _exit(false) |
| 216 | , _has_save_dir(save_dir != NULL && save_dir[0] != '\0') |
| 217 | { |
| 218 | CE_ENSURE(s_save_game == NULL); |
| 219 | |
| 220 | if (_has_save_dir) { |
| 221 | _filesystem.set_prefix(save_dir); |
| 222 | CreateResult cr = _filesystem.create_directory(""); |
| 223 | if (cr.error == CreateResult::UNKNOWN) |
| 224 | logw(SAVE_GAME, "Unable to create save directory '%s'", save_dir); |
| 225 | } |
| 226 | |
| 227 | #if CROWN_PLATFORM_EMSCRIPTEN |
| 228 | if (_has_save_dir) |
| 229 | html5_save_game_init(save_dir); |
| 230 | #endif |
| 231 | |
| 232 | _thread.start([](void *thiz) { return ((SaveGame *)thiz)->run(); }, this); |
| 233 | } |
| 234 | |
| 235 | /// |
| 236 | ~SaveGame() |
nothing calls this directly
no test coverage detected