Fix linux build

This commit is contained in:
Phillip Stephens 2017-02-05 14:27:26 -08:00
parent fc4c9d6947
commit 8c94fe8f63
1 changed files with 24 additions and 0 deletions

View File

@ -30,4 +30,28 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
return path;
}
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot)
{
const char* home = getenv("HOME");
if (!home || home[0] != '/')
return {};
const char* dataHome = getenv("XDG_DATA_HOME");
/* XDG-selected data path */
kabufuda::SystemString path =
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu/GC";
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
path += hecl::Format("/MemoryCard%c.USA.raw",
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
FILE* fp = hecl::Fopen(path.c_str(), "wb");
if (!fp)
return {};
fclose(fp);
return path;
}
}