sync files whenever pilot file is saved
authorTaylor Richards <taylor@icculus.org>
Sat, 24 Feb 2018 13:08:36 +0000 (08:08 -0500)
committerTaylor Richards <taylor@icculus.org>
Sat, 17 Mar 2018 15:31:15 +0000 (11:31 -0400)
src/freespace2/freespace.cpp
src/playerman/managepilot.cpp

index 2fa5030..b5f6f83 100644 (file)
@@ -6943,15 +6943,6 @@ void game_shutdown(void)
        psnet_close();
        os_cleanup();
 
-#ifdef __EMSCRIPTEN__
-       // sync files to persistent storage
-       EM_ASM(
-               FS.syncfs(function(err) {
-                       assert(!err);
-               });
-       );
-#endif
-
        // HACKITY HACK HACK
        // if this flag is set, we should be firing up the launcher when exiting freespace
        extern int Multi_update_fireup_launcher_on_exit;
index 77e5be5..3c6fe01 100644 (file)
@@ -1384,6 +1384,16 @@ void write_pilot_file(player *the_player)
                popup_callback(error_writing_callback, PF_TITLE_RED | PF_TITLE_BIG, 3, XSTR( "&Retry", 41), XSTR( "&Ignore", 42), XSTR( "&Quit Game", 43),
                        XSTR( "Warning\nFailed to save pilot file.  You may be out of disk space.  If so, you should press Alt-Tab, free up some disk space, then come back and choose retry.\n", 44) );
        }
+#ifdef __EMSCRIPTEN__
+       else {
+               // sync files to persistent storage
+               EM_ASM(
+                       FS.syncfs(function(err) {
+                               assert(!err);
+                       });
+               );
+       }
+#endif
 }
 
 void write_stats_block(CFILE *file,scoring_struct *stats)