Willy-JL 2 лет назад
Родитель
Сommit
0e7bd55546
1 измененных файлов с 2 добавлено и 7 удалено
  1. 2 7
      asteroids/app.c

+ 2 - 7
asteroids/app.c

@@ -28,7 +28,7 @@
 #define MAXPOWERUPS 3 /* Max powerups allowed on screen */
 #define POWERUPSTTL 400 /* Max powerup time to live, in ticks. */
 #define SHIP_HIT_ANIMATION_LEN 15
-#define SAVING_DIRECTORY "/ext/apps/Games"
+#define SAVING_DIRECTORY STORAGE_APP_DATA_PATH_PREFIX
 #define SAVING_FILENAME SAVING_DIRECTORY "/game_asteroids.save"
 #ifndef PI
 #define PI 3.14159265358979f
@@ -1146,6 +1146,7 @@ void game_tick(void* ctx) {
 
 bool load_game(AsteroidsApp* app) {
     Storage* storage = furi_record_open(RECORD_STORAGE);
+    storage_common_migrate(storage, EXT_PATH("apps/Games/game_asteroids.save"), SAVING_FILENAME);
 
     File* file = storage_file_alloc(storage);
     uint16_t bytes_readed = 0;
@@ -1163,12 +1164,6 @@ bool load_game(AsteroidsApp* app) {
 void save_game(AsteroidsApp* app) {
     Storage* storage = furi_record_open(RECORD_STORAGE);
 
-    if(storage_common_stat(storage, SAVING_DIRECTORY, NULL) == FSE_NOT_EXIST) {
-        if(!storage_simply_mkdir(storage, SAVING_DIRECTORY)) {
-            return;
-        }
-    }
-
     File* file = storage_file_alloc(storage);
     if(storage_file_open(file, SAVING_FILENAME, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
         storage_file_write(file, app, sizeof(AsteroidsApp));