Пример #1
0
//
// SetSaveGameDir
//
// Chooses the directory used to store saved games.
//
void D_SetSaveGameDir(void)
{
    char    *iwad_name;

    if (!strcmp(configdir, ""))
    {
        // Use the current directory, just like configdir.

        savegamedir = strdup("");
    }
    else
    {
        // Directory for savegames

        iwad_name = SaveGameIWADName();

        if (iwad_name == NULL)
        {
            iwad_name = "unknown.wad";
        }

        savegamedir = Z_Malloc(strlen(configdir) + 30, PU_STATIC, 0);
        sprintf(savegamedir, "%ssavegames%c", configdir, DIR_SEPARATOR);

        M_MakeDirectory(savegamedir);

        sprintf(savegamedir + strlen(savegamedir), "%s%c",
                iwad_name, DIR_SEPARATOR);

        M_MakeDirectory(savegamedir);
    }
}
Пример #2
0
char *M_GetSaveGameDir(char *iwadname)
{
    char *savegamedir;

    // If not "doing" a configuration directory (Windows), don't "do"
    // a savegame directory, either.

    if (!strcmp(configdir, ""))
    {
	savegamedir = strdup("");
    }
    else
    {
        // ~/.chocolate-doom/savegames/

        savegamedir = malloc(strlen(configdir) + 30);
        sprintf(savegamedir, "%ssavegames%c", configdir,
                             DIR_SEPARATOR);

        M_MakeDirectory(savegamedir);

        // eg. ~/.chocolate-doom/savegames/doom2.wad/

        sprintf(savegamedir + strlen(savegamedir), "%s%c",
                iwadname, DIR_SEPARATOR);

        M_MakeDirectory(savegamedir);
    }

    return savegamedir;
}
Пример #3
0
//
// SetSaveGameDir
//
// Chooses the directory used to store saved games.
//
void D_SetSaveGameDir(void)
{
    char *iwad_name = SaveGameIWADName();

    if (iwad_name == NULL)
        iwad_name = "unknown.wad";

    M_MakeDirectory("savegames");

    savegamedir = M_StringJoin("savegames", DIR_SEPARATOR_S, iwad_name, DIR_SEPARATOR_S, NULL);
    M_MakeDirectory(savegamedir);
}
void M_SetConfigDir(void)
{
#if !defined(_WIN32) || defined(_WIN32_WCE)

    // Configuration settings are stored in ~/.chocolate-doom/,
    // except on Windows, where we behave like Vanilla Doom and
    // save in the current directory.

    char *homedir;

    homedir = getenv("HOME");

    if (homedir != NULL)
    {
        // put all configuration in a config directory off the
        // homedir

        configdir = malloc(strlen(homedir) + strlen(PACKAGE_TARNAME) + 5);

        sprintf(configdir, "%s%c.%s%c", homedir, DIR_SEPARATOR,
			                PACKAGE_TARNAME, DIR_SEPARATOR);

        // make the directory if it doesnt already exist

        M_MakeDirectory(configdir);
    }
    else
#endif /* #ifndef _WIN32 */
    {
#if defined(_WIN32) && !defined(_WIN32_WCE)
        //!
        // @platform windows
        // @vanilla
        //
        // Save configuration data and savegames in c:\doomdata,
        // allowing play from CD.
        //

        if (M_CheckParm("-cdrom") > 0)
        {
            printf(D_CDROM);
            configdir = strdup("c:\\doomdata\\");

            M_MakeDirectory(configdir);
        }
        else
#endif
        {
            configdir = strdup("");
        }
    }
}
Пример #5
0
void M_SetConfigDir(void)
{
#if !defined(_WIN32) || defined(_WIN32_WCE)

    // Configuration settings are stored in ~/.mint-doom/,
    // except on Windows, where we behave like Vanilla Doom and
    // save in the current directory.

    char *homedir;

    homedir = getenv("HOME");

    if (homedir != NULL)
    {
        // put all configuration in a config directory off the
        // homedir

        configdir = malloc(strlen(homedir) + strlen(PACKAGE_TARNAME) + 5);

        sprintf(configdir, "%s%c.%s%c", homedir, DIR_SEPARATOR,
			                PACKAGE_TARNAME, DIR_SEPARATOR);

        // make the directory if it doesnt already exist

        M_MakeDirectory(configdir);
    }
    else
#endif /* #ifndef _WIN32 */
    {
#if defined(_WIN32) && !defined(_WIN32_WCE)
        // when given the -cdrom option, save config+savegames in 
        // c:\doomdata.  This only applies under Windows.

        if (M_CheckParm("-cdrom") > 0)
        {
            printf(D_CDROM);
            configdir = strdup("c:\\doomdata\\");

            M_MakeDirectory(configdir);
        }
        else
#endif
        {
            configdir = strdup("");
        }
    }
}
Пример #6
0
void M_SetConfigDir(char *dir)
{
    // Use the directory that was passed, or find the default.

    if (dir != NULL)
    {
        configdir = dir;
    }
    else
    {
        configdir = GetDefaultConfigDir();
    }

    if (strcmp(configdir, "") != 0)
    {
        printf("Using %s for configuration and saves\n", configdir);
    }

    // Make the directory if it doesn't already exist:

    M_MakeDirectory(configdir);
}
Пример #7
0
static void CreateSavePath(void)
{
    M_MakeDirectory(SavePath);
}