Exemple #1
0
 void Initialize()
 {
     # ifdef TA3D_PLATFORM_WINDOWS
     initForWindows();
     # else
     #   ifndef TA3D_PLATFORM_DARWIN
     initForDefaultUnixes();
     #   else
     initForDarwin();
     #   endif
     # endif
 }
Exemple #2
0
		bool Initialize(int /*argc*/, char* argv[], const String& programName)
		{
			LOG_ASSERT(NULL != argv);
			LOG_ASSERT(!programName.empty());

			initApplicationRootPath(argv[0]);

			# ifdef TA3D_PLATFORM_WINDOWS
			initForWindows();
			# else
			#   ifndef TA3D_PLATFORM_DARWIN
			initForDefaultUnixes();
			#   else
			initForDarwin();
			#   endif
			# endif

			// Initialize the logging mecanism
			ResetTheLoggingMecanism(Yuni::String(Paths::Logs) <<programName << ".log");

			// Welcome Commander !
			logs.checkpoint() << "Welcome to TA3D";
			logs.checkpoint() << "Version: " << TA3D_VERSION_HI << "." << TA3D_VERSION_LO << "-" << TA3D_VERSION_TAG
				<< " (r" << TA3D_CURRENT_REVISION << ")";
			logs.info();

			LOG_INFO(LOG_PREFIX_PATHS << "Started from: `" << ApplicationRoot << "`");
			ConfigFile = Preferences;
			ConfigFile += "ta3d.cfg";
			LOG_INFO(LOG_PREFIX_PATHS << "Preferences: `" << Preferences << "`");
			LOG_INFO(LOG_PREFIX_PATHS << "Cache: `" << Caches << "`");
			LOG_INFO(LOG_PREFIX_PATHS << "Savegames: `" << Savegames << "`");
			LOG_INFO(LOG_PREFIX_PATHS << "Screenshots: `" << Screenshots << "`");
			LOG_INFO(LOG_PREFIX_PATHS << "Logs: `" << Logs << "`");

			// Informations about the log file
			if (!logs.logFileIsOpened())
				logs.error() << "Logs: Impossible to open `" << logs.logfile() << "`";
			else
				logs.info() << "Opened the log file: `" << logs.logfile() << "`";

			bool res = MakeDir(Caches) && MakeDir(Savegames) && MakeDir(Logs)
				&& MakeDir(Preferences) && MakeDir(Screenshots) && MakeDir(Resources)
				&& MakeDir(String(Savegames) << "multiplayer" << Paths::Separator);
			if (!res)
			{
				logs.fatal() << "Some paths are missing. Aborting now...";
				exit(120);
			}

			return res;
		}