Index: framework/Common.cpp
===================================================================
--- framework/Common.cpp	(revision 5327)
+++ framework/Common.cpp	(working copy)
@@ -139,7 +139,7 @@
 	virtual void				StartupVariable( const char *match, bool once );
 	virtual void				InitTool( const toolFlag_t tool, const idDict *dict );
 	virtual void				ActivateTool( bool active );
-	virtual void				WriteConfigToFile( const char *filename, const char* basePath = "fs_modSavePath" );
+	virtual void				WriteConfigToFile( const char *filename, const char* basePath = "fs_basepath" );
 	virtual void				WriteFlaggedCVarsToFile( const char *filename, int flags, const char *setCmd );
 	virtual void				BeginRedirect( char *buffer, int buffersize, void (*flush)( const char * ) );
 	virtual void				EndRedirect( void );
@@ -967,7 +967,7 @@
 idCommonLocal::SafeMode
 
 Check for "safe" on the command line, which will
-skip loading of config file (DoomConfig.cfg)
+skip loading of config file (Darkmod.cfg)
 ==================
 */
 bool idCommonLocal::SafeMode( void ) {
@@ -1159,7 +1159,7 @@
 	idBase64 out;
 #endif
 
-	f = fileSystem->OpenFileWrite( filename, basePath );
+	f = fileSystem->OpenFileWrite( filename, basePath, "darkmod" );
 	if ( !f ) {
 		Printf ("Couldn't write %s.\n", filename );
 		return;
@@ -3046,7 +3046,7 @@
 
 	// skip the config file if "safe" is on the command line
 	if ( !SafeMode() ) {
-		cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "exec " CONFIG_FILE "\n" );		// DoomConfig.cfg
+		cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "exec " CONFIG_FILE "\n" );		// Darkmod.cfg
 	}
 	cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "exec autoexec.cfg\n" );
 
Index: framework/Common.h
===================================================================
--- framework/Common.h	(revision 5327)
+++ framework/Common.h	(working copy)
@@ -146,7 +146,7 @@
 
 								// Writes the user's configuration to a file
 								// greebo: Added the basePath option to allow for more control
-	virtual void				WriteConfigToFile( const char *filename, const char* basePath = "fs_modSavePath" ) = 0;
+	virtual void				WriteConfigToFile( const char *filename, const char* basePath = "fs_basepath" ) = 0;
 
 								// Writes cvars with the given flags to a file.
 	virtual void				WriteFlaggedCVarsToFile( const char *filename, int flags, const char *setCmd ) = 0;
@@ -193,9 +193,9 @@
 								// greebo: Provides access to I18N-related methods
 	virtual I18N*				GetI18N() = 0;
 
-						// take a string like "#str_12345" and return a translated version of it.
-						// Shortcut to GetI18N()->Translate()
-	virtual const char *			Translate( const char * str ) = 0;
+						        // take a string like "#str_12345" and return a translated version of it.
+						        // Shortcut to GetI18N()->Translate()
+	virtual const char *		Translate( const char * str ) = 0;
 
 								// Returns key bound to the command
 	virtual const char *		KeysFromBinding( const char *bind ) = 0;
Index: framework/FileSystem.cpp
===================================================================
--- framework/FileSystem.cpp	(revision 5327)
+++ framework/FileSystem.cpp	(working copy)
@@ -249,7 +249,7 @@
 	virtual void			RemoveFile( const char *relativePath );	
 	virtual idFile *		OpenFileReadFlags( const char *relativePath, int searchFlags, pack_t **foundInPak = NULL, bool allowCopyFiles = true, const char* gamedir = NULL );
 	virtual idFile *		OpenFileRead( const char *relativePath, bool allowCopyFiles = true, const char* gamedir = NULL );
-	virtual idFile *		OpenFileWrite( const char *relativePath, const char *basePath = "fs_modSavePath" );
+	virtual idFile *		OpenFileWrite( const char *relativePath, const char *basePath = "fs_modSavePath", const char *gamedir = NULL );
 	virtual idFile *		OpenFileAppend( const char *relativePath, bool sync = false, const char *basePath = "fs_basepath"   );
 	virtual idFile *		OpenFileByMode( const char *relativePath, fsMode_t mode );
 	virtual idFile *		OpenExplicitFileRead( const char *OSPath );
@@ -2792,7 +2792,7 @@
 idFileSystemLocal::OpenFileWrite
 ===========
 */
-idFile *idFileSystemLocal::OpenFileWrite( const char *relativePath, const char *basePath ) {
+idFile *idFileSystemLocal::OpenFileWrite( const char *relativePath, const char *basePath, const char *gamedir) {
 	const char *path;
 	idStr OSpath;
 	idFile_Permanent *f;
@@ -2806,7 +2806,7 @@
 		path = fs_savepath.GetString();
 	}
 
-	OSpath = BuildOSPath( path, gameFolder, relativePath );
+	OSpath = BuildOSPath( path, gamedir ? gamedir : gameFolder.c_str(), relativePath );
 
 	if ( fs_debug.GetInteger() ) {
 		common->Printf( "idFileSystem::OpenFileWrite: %s\n", OSpath.c_str() );
Index: framework/FileSystem.h
===================================================================
--- framework/FileSystem.h	(revision 5327)
+++ framework/FileSystem.h	(working copy)
@@ -192,7 +192,7 @@
 							// Opens a file for reading.
 	virtual idFile *		OpenFileRead( const char *relativePath, bool allowCopyFiles = true, const char* gamedir = NULL ) = 0;
 							// Opens a file for writing, will create any needed subdirectories.
-	virtual idFile *		OpenFileWrite( const char *relativePath, const char *basePath = "fs_modSavePath" ) = 0;
+	virtual idFile *		OpenFileWrite( const char *relativePath, const char *basePath = "fs_modSavePath", const char *gamedir = NULL ) = 0;
 							// Opens a file for writing at the end.
 	virtual idFile *		OpenFileAppend( const char *filename, bool sync = false, const char *basePath = "fs_basepath" ) = 0;
 							// Opens a file for reading, writing, or appending depending on the value of mode.
Index: framework/Licensee.h
===================================================================
--- framework/Licensee.h	(revision 5327)
+++ framework/Licensee.h	(working copy)
@@ -39,7 +39,7 @@
 
 // filenames
 #define	CD_EXE							"doom.exe"
-#define CONFIG_FILE						"DoomConfig.cfg"
+#define CONFIG_FILE						"Darkmod.cfg"
 
 // base folder where the source code lives
 #define SOURCE_CODE_BASE_FOLDER			"neo"
Index: game/Game_local.cpp
===================================================================
--- game/Game_local.cpp	(revision 5327)
+++ game/Game_local.cpp	(working copy)
@@ -652,6 +652,7 @@
 		return;
 	}
 
+#if 0
 	if (cv_tdm_fm_sync_config_files.GetBool())
 	{
 		// greebo: Check if we have a game base. If yes, write the current configuration back to the
@@ -662,9 +663,10 @@
 		{
 			// This should write the file into darkmod/ instead of darkmod/fms/outpost/..darkmod/,
 			// therefore use fs_savePath as base.
-			common->WriteConfigToFile("../" + fs_game_base + "/DoomConfig.cfg", "fs_savePath");
-		}
+			common->WriteConfigToFile("../" + fs_game_base + "/" + CONFIG_FILE, "fs_savePath");
+		} // CONFIG_FILE
 	}
+#endif
 
 	Printf( "------------ Game Shutdown -----------\n" );
 	
Index: game/Missions/MissionManager.cpp
===================================================================
--- game/Missions/MissionManager.cpp	(revision 5327)
+++ game/Missions/MissionManager.cpp	(working copy)
@@ -872,10 +872,10 @@
 		DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("FM targetFolder already exists: %s\r", targetFolder.string().c_str());
 	}
 
+#if 0
 	// Path to the darkmod directory
 	fs::path darkmodPath = GetDarkmodPath();
 
-#if 0
 	// greebo: We don't copy PK4s around anymore, they remain in the fms/ subfolders
 
 	// Copy all PK4s from the FM folder (and all subdirectories)
@@ -908,17 +908,22 @@
 	// Save the name to currentfm.txt
 	WriteCurrentFmFile(modName);
 
-	// Assemble the path to the FM's DoomConfig.cfg
-	fs::path doomConfigPath = targetFolder / "DoomConfig.cfg";
+    // taaaki: now that fms are loaded directly from <basepath>/darkmod/fms/ 
+    //         we don't need to copy config files around (i.e. just use the 
+    //         one in <basepath>/darkmod/ (same with config.spec)
+
+#if 0
+	// Assemble the path to the FM's Darkmod.cfg
+	fs::path doomConfigPath = targetFolder / CONFIG_FILE;
 	
-	// Check if we should synchronise DoomConfig.cfg files
+	// Check if we should synchronise Darkmod.cfg files
 	if (cv_tdm_fm_sync_config_files.GetBool())
 	{
-		// Yes, sync DoomConfig.cfg
+		// Yes, sync Darkmod.cfg
 
-		// Always copy the DoomConfig.cfg from darkmod/ to the new mod/
-		// Remove any DoomConfig.cfg that might exist there beforehand
-		if (!DoCopyFile(darkmodPath / "DoomConfig.cfg", doomConfigPath, true))
+		// Always copy the Darkmod.cfg from darkmod/ to the new mod/
+		// Remove any Darkmod.cfg that might exist there beforehand
+		if (!DoCopyFile(darkmodPath / CONFIG_FILE, doomConfigPath, true))
 		{
 			// Failed copying
 			return COPY_FAILURE;
@@ -926,12 +931,12 @@
 	}
 	else
 	{
-		// No, don't sync DoomConfig.cfg, but at least copy a basic one over there if it doesn't exist
+		// No, don't sync Darkmod.cfg, but at least copy a basic one over there if it doesn't exist
 		if (!fs::exists(doomConfigPath))
 		{
-			DM_LOG(LC_MAINMENU, LT_INFO)LOGSTRING("DoomConfig.cfg not found in FM folder, copy over from darkmod.\r");
+			DM_LOG(LC_MAINMENU, LT_INFO)LOGSTRING("%s not found in FM folder, copy over from darkmod.\r", CONFIG_FILE);
 
-			if (!DoCopyFile(darkmodPath / "DoomConfig.cfg", doomConfigPath))
+			if (!DoCopyFile(darkmodPath / CONFIG_FILE, doomConfigPath))
 			{
 				// Failed copying
 				return COPY_FAILURE;
@@ -950,6 +955,7 @@
 			return COPY_FAILURE;
 		}
 	}
+#endif
 
 	return INSTALLED_OK;
 }
