2015-11-24 23:46:52 +01:00
|
|
|
/*
|
2016-02-21 16:50:27 +01:00
|
|
|
Copyright (C) 2015-2016 Parallel Realities
|
2015-11-24 23:46:52 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "win32Init.h"
|
|
|
|
|
|
|
|
void createSaveFolder(void)
|
|
|
|
{
|
2016-02-24 08:17:53 +01:00
|
|
|
char *userHome;
|
|
|
|
char dir[MAX_FILENAME_LENGTH];
|
|
|
|
|
2016-02-25 13:27:08 +01:00
|
|
|
userHome = getenv("USERPROFILE");
|
2016-02-24 08:17:53 +01:00
|
|
|
|
|
|
|
if (!userHome)
|
|
|
|
{
|
|
|
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Unable to determine user save folder. Will save to current dir.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "User home = %s", userHome);
|
|
|
|
|
2016-02-25 13:27:08 +01:00
|
|
|
sprintf(dir, "%s\\tbftss", userHome);
|
2016-02-25 12:46:39 +01:00
|
|
|
if (mkdir(dir) != 0 && errno != EEXIST)
|
2016-02-24 08:17:53 +01:00
|
|
|
{
|
|
|
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to create save dir '%s'. Will save to current dir.", dir);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
STRNCPY(app.saveDir, dir, MAX_FILENAME_LENGTH);
|
2015-11-24 23:46:52 +01:00
|
|
|
}
|