std::string PlatformFolders::getSaveGamesFolder1() const {
#if defined(_WIN32)
	//A dedicated Save Games folder was not introduced until Vista. For XP and older save games are most often saved in a normal folder named "My Games".
	//Data that should not be user accessible should be placed under GetDataHome() instead
	return GetWindowsFolder(CSIDL_PERSONAL, "Failed to find My Documents folder")+"\\My Games";
#elif defined(__APPLE__)
	return GetMacFolder(kApplicationSupportFolderType, "Failed to find Application Support Folder");
#else
	return getDataHome();
#endif
}
Beispiel #2
0
int main(int argc, char *argv[])
{
#ifdef WITH_IMAGEMAGICK
	Magick::InitializeMagick(*argv);
#endif

	QCoreApplication *a = (argc == 1) ? new QApplication(argc, argv) : new QCoreApplication(argc, argv);

	if(a)
	{
		/* we need nice getDataHome */
		#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
		QCoreApplication::setApplicationName("luckygps");
		QCoreApplication::setOrganizationName(".");
		#endif

		QLocale locale = QLocale::system();
		QString locale_name = locale.name();
		QTranslator translator;

		/* Detect if luckyGPS is executed in "local mode" (no installation) */
		int local = 0;
		QDir dir(QCoreApplication::applicationDirPath());
		QFileInfoList fileList = dir.entryInfoList(QStringList("luckygps_*.qm"), QDir::AllEntries | QDir::NoDot | QDir::NoDotDot);
		if(fileList.length() > 0)
			local = 1;

#if defined(Q_OS_LINUX)
		translator.load(QString("luckygps_") + locale_name, "/usr/share/luckygps");
#else
		translator.load(QString("luckygps_") + locale_name, getDataHome(local));
#endif

		a->installTranslator(&translator);
		setlocale(LC_NUMERIC, "C");

		if(argc == 1)
		{
			MainWindow w(0, local);
			w.show();

			a->exec();
		}
#ifdef WITH_ROUTING
		else
		{
			/* check if 1 argument is given */
			if(argc > 3)
			{
				printf("\nUsage: luckygps FILE.osm.pbf [SETTINGS.spp]\n");
			}
			else
			{
				QString settingsFile;
				if(argc == 2)
					settingsFile = ":/data/motorcar.spp";
				else
					settingsFile = QString(argv[2]);

				/* import osm file into routing database */
				if(importOsmPbf(a, argv[1], settingsFile, local))
					qWarning() << "Import successfully.";
				else
					qWarning() << "Import failed.";
			}
		}
#endif

		delete a;
	}

	return true;
}