Esempio n. 1
0
static void GetBaseFilepath(char *filepath, int maxlen)
{
    const char *SshotDir = ConfigGetParamString(g_CoreConfig, "ScreenshotPath");

    // sanity check input
    if (filepath == NULL)
        return;
    if (maxlen < 32)
    {
        filepath[0] = 0;
        return;
    }

    /* get the path to store screenshots */
    strncpy(filepath, SshotDir, maxlen - 24);
    filepath[maxlen-24] = 0;
    if (strlen(filepath) == 0)
    {
        snprintf(filepath, maxlen - 24, "%sscreenshot%c", ConfigGetUserDataPath(), OSAL_DIR_SEPARATOR);
        osal_mkdirp(filepath, 0700);
    }

    /* make sure there is a slash on the end of the pathname */
    int pathlen = strlen(filepath);
    if (pathlen > 0 && filepath[pathlen-1] != OSAL_DIR_SEPARATOR)
    {
        filepath[pathlen] = OSAL_DIR_SEPARATOR;
        filepath[pathlen+1] = 0;
    }

    // add the game's name to the end, convert to lowercase, convert spaces to underscores
    char *pch = filepath + strlen(filepath);
    char ch;
    strncpy(pch, (char*) ROM_HEADER->nom, 20);
    pch[20] = '\0';
    do
    {
        ch = *pch;
        if (ch == ' ')
            *pch++ = '_';
        else
            *pch++ = tolower(ch);
    } while (ch != 0);

    return;
}
void PluginAPI::GetUserDataPath(wchar_t * _strPath)
{
	_getWSPath(ConfigGetUserDataPath(), _strPath);
}