win32.c
changeset 3287 720ed37be8c6
parent 3204 2f2e12688e97
child 3329 992d1f7cb747
equal deleted inserted replaced
3286:3250f1488eb2 3287:720ed37be8c6
   961 
   961 
   962 	SetErrorMode(sem); // reset previous setting
   962 	SetErrorMode(sem); // reset previous setting
   963 	return sid;
   963 	return sid;
   964 }
   964 }
   965 
   965 
   966 void FiosMakeSavegameName(char *buf, const char *name)
   966 void FiosMakeSavegameName(char *buf, const char *name, size_t size)
   967 {
   967 {
   968 	const char* extension;
   968 	const char* extension;
   969 	const char* period;
   969 	const char* period;
   970 
   970 
   971 	if (_game_mode == GM_EDITOR)
   971 	if (_game_mode == GM_EDITOR)
   975 
   975 
   976 	// Don't append the extension, if it is already there
   976 	// Don't append the extension, if it is already there
   977 	period = strrchr(name, '.');
   977 	period = strrchr(name, '.');
   978 	if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
   978 	if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
   979 
   979 
   980 	sprintf(buf, "%s\\%s%s", _fios_path, name, extension);
   980 	snprintf(buf, size, "%s\\%s%s", _fios_path, name, extension);
   981 }
   981 }
   982 
   982 
   983 bool FiosDelete(const char *name)
   983 bool FiosDelete(const char *name)
   984 {
   984 {
   985 	char path[512];
   985 	char path[512];
   986 
   986 
   987 	snprintf(path, lengthof(path), "%s\\%s", _fios_path, name);
   987 	FiosMakeSavegameName(path, name, sizeof(path));
   988 	return DeleteFile(path) != 0;
   988 	return DeleteFile(path) != 0;
   989 }
   989 }
   990 
   990 
   991 bool FileExists(const char *filename)
   991 bool FileExists(const char *filename)
   992 {
   992 {