Skip to content

Commit

Permalink
Store miyoo mini cdata in rom directory
Browse files Browse the repository at this point in the history
ensure the cdata directory is created as well
Fix bad cdata errors
  • Loading branch information
jtothebell committed Apr 16, 2022
1 parent 6701ce5 commit aa4fc5e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions platform/miyoomini/source/MiyooMiniHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -210,10 +212,19 @@ Host::Host() {

#else
_cartDirectory = "/mnt/SDCARD/Roms/PICO";
char cwdbuf[256];
getcwd(cwdbuf, 255);
strcat(cwdbuf, "/");
_logFilePrefix = cwdbuf;
_logFilePrefix = "/mnt/SDCARD/Roms/PICO/";

struct stat st = {0};
int res = 0;

string cartdatadir = _logFilePrefix + "cdata";
if (stat(cartdatadir.c_str(), &st) == -1) {
res = mkdir(cartdatadir.c_str(), 0777);
}

if (res != 0){
Logger_Write("error creating cdata directory. Cart data will not save.\n");
}
#endif

}
Expand Down

0 comments on commit aa4fc5e

Please sign in to comment.