[Scummvm-cvs-logs] SF.net SVN: scummvm:[50301] scummvm/branches/gsoc2010-opengl/backends/ platform/sdl

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Sat Jun 26 05:44:47 CEST 2010


Revision: 50301
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50301&view=rev
Author:   vgvgf
Date:     2010-06-26 03:44:47 +0000 (Sat, 26 Jun 2010)

Log Message:
-----------
Removed DEFAULT_CONFIG_FILE define in favor of new getConfigFileNameString function.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.cpp	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.cpp	2010-06-26 03:44:47 UTC (rev 50301)
@@ -33,8 +33,6 @@
 
 #include "CoreFoundation/CoreFoundation.h"
 
-#define DEFAULT_CONFIG_FILE "Library/Preferences/ScummVM Preferences"
-
 OSystem_MacOSX::OSystem_MacOSX() {
 }
 
@@ -51,18 +49,8 @@
 	OSystem_POSIX::initBackend();
 }
 
-Common::String OSystem_MacOSX::getDefaultConfigFileName() {
-	char configFile[MAXPATHLEN];
-
-	// On UNIX type systems, by default we store the config file inside
-	// to the HOME directory of the user.
-	const char *home = getenv("HOME");
-	if (home != NULL && strlen(home) < MAXPATHLEN)
-		snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG_FILE);
-	else
-		strcpy(configFile, DEFAULT_CONFIG_FILE);
-
-	return configFile;
+const char *OSystem_MacOSX::getConfigFileNameString() {
+	return "Library/Preferences/ScummVM Preferences";
 }
 
 void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.h	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/macosx/macosx.h	2010-06-26 03:44:47 UTC (rev 50301)
@@ -38,6 +38,7 @@
 	void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
 
 protected:
+	const char *getConfigFileNameString();
 	Common::String getDefaultConfigFileName();
 };
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp	2010-06-26 03:44:47 UTC (rev 50301)
@@ -41,8 +41,6 @@
 
 #include "backends/fs/posix/posix-fs-factory.h"
 
-#define DEFAULT_CONFIG_FILE ".scummvmrc"
-
 OSystem_POSIX::OSystem_POSIX() {
 }
 
@@ -63,6 +61,10 @@
 	OSystem_SDL::initBackend();
 }
 
+const char *OSystem_POSIX::getConfigFileNameString() {
+	return ".scummvmrc";
+}
+
 Common::String OSystem_POSIX::getDefaultConfigFileName() {
 	char configFile[MAXPATHLEN];
 
@@ -76,9 +78,9 @@
 	// from the Springboard, is /. Which we don't want.
 	const char *home = getenv("HOME");
 	if (home != NULL && strlen(home) < MAXPATHLEN)
-		snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG_FILE);
+		snprintf(configFile, MAXPATHLEN, "%s/%s", home, getConfigFileNameString());
 	else
-		strcpy(configFile, DEFAULT_CONFIG_FILE);
+		strcpy(configFile, getConfigFileNameString());
 
 	return configFile;
 }

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h	2010-06-26 03:44:47 UTC (rev 50301)
@@ -38,6 +38,7 @@
 	virtual void initBackend();
 
 protected:
+	virtual const char *getConfigFileNameString();
 	virtual Common::String getDefaultConfigFileName();
 };
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-06-26 03:44:47 UTC (rev 50301)
@@ -38,8 +38,6 @@
 
 #include "icons/scummvm.xpm"
 
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
-
 #include <time.h>
 
 OSystem_SDL::OSystem_SDL()
@@ -129,9 +127,13 @@
 
 }
 
+const char *OSystem_SDL::getConfigFileNameString() {
+	return "scummvm.ini";
+}
+
 Common::String OSystem_SDL::getDefaultConfigFileName() {
 	char configFile[MAXPATHLEN];
-	strcpy(configFile, DEFAULT_CONFIG_FILE);
+	strcpy(configFile, getConfigFileNameString());
 	return configFile;
 }
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-06-26 03:44:47 UTC (rev 50301)
@@ -79,6 +79,7 @@
 
 	virtual void setupIcon();
 
+	virtual const char *getConfigFileNameString();
 	virtual Common::String getDefaultConfigFileName();
 };
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp	2010-06-26 03:44:47 UTC (rev 50301)
@@ -44,8 +44,6 @@
 
 #include "backends/fs/windows/windows-fs-factory.h"
 
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
-
 OSystem_Win32::OSystem_Win32() {
 }
 
@@ -57,6 +55,10 @@
 	OSystem_SDL::init();
 }
 
+const char *OSystem_Win32::getConfigFileNameString() {
+	return "\\scummvm.ini";
+}
+
 Common::String OSystem_Win32::getDefaultConfigFileName() {
 	char configFile[MAXPATHLEN];
 
@@ -80,14 +82,14 @@
 
 		strcat(configFile, "\\ScummVM");
 		CreateDirectory(configFile, NULL);
-		strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
+		strcat(configFile, getConfigFileNameString());
 
 		FILE *tmp = NULL;
 		if ((tmp = fopen(configFile, "r")) == NULL) {
 			// Check windows directory
 			char oldConfigFile[MAXPATHLEN];
 			GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
-			strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE);
+			strcat(oldConfigFile, getConfigFileNameString());
 			if ((tmp = fopen(oldConfigFile, "r"))) {
 				strcpy(configFile, oldConfigFile);
 
@@ -99,7 +101,7 @@
 	} else {
 		// Check windows directory
 		GetWindowsDirectory(configFile, MAXPATHLEN);
-		strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
+		strcat(configFile, getConfigFileNameString());
 	}
 
 	return configFile;

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h	2010-06-26 02:42:50 UTC (rev 50300)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h	2010-06-26 03:44:47 UTC (rev 50301)
@@ -36,6 +36,7 @@
 	void init();
 
 protected:
+	const char *getConfigFileNameString();
 	Common::String getDefaultConfigFileName();
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list