Ejemplo n.º 1
0
CLIB_API const boost::filesystem::path & GetUserFolder(boost::filesystem::path & path, const std::_tstring & user)
{
    boost::filesystem::path applicationFolder;
    path = GetApplicationFolder(applicationFolder) / stringToPath(user);
    boost::filesystem::create_directories(path);
    return path;
}
Ejemplo n.º 2
0
	void RestoreDefaults()
	{
		boost::filesystem::path appFolder;
		GetApplicationFolder(appFolder);
		boost::filesystem::path file = appFolder / stringToPath(ColorFileName().GetString());
		if (clib::filesystem::exists(file))
			boost::filesystem::remove(file);
		loadMergedColor();
	}
Ejemplo n.º 3
0
CLIB_API const boost::filesystem::path & GetConfigPath(const std::_tstring & environment, boost::filesystem::path & path)
{
    boost::filesystem::path applicationFolder;
    std::_tstring CfgFileName = environment;
    if (CfgFileName.find('.') == std::_tstring::npos)
    {
        CfgFileName += _T(".");
        CfgFileName += CFG;
    }
    path = GetApplicationFolder(applicationFolder) / stringToPath(CfgFileName);
    return path;
}
Ejemplo n.º 4
0
 void InitConfigPath(const std::_tstring & cfgName, const std::_tstring & ext)
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     m_CfgName = cfgName;
     ATLASSERT((cfgName.find('.') == std::_tstring::npos));
     ATLASSERT((ext.find('.') == std::_tstring::npos));
     std::_tstring cfgNameExt = cfgName;
     cfgNameExt += _T(".");
     cfgNameExt += ext;
     boost::filesystem::path appFolder;
     m_CfgPath = GetApplicationFolder(appFolder) / stringToPath(cfgNameExt);
     m_Cfg.SetFilename(pathToWString(m_CfgPath).c_str());
 }
Ejemplo n.º 5
0
CLIB_API const boost::filesystem::path & GetIniPath(boost::filesystem::path & path)
{
    boost::filesystem::path programPath;
    std::string leaf = pathToString(GetProgramPath(programPath).leaf());
    TCHAR szFileName[_MAX_FNAME];
    TCHAR szExt[_MAX_FNAME];
    _tsplitpath(CA2T(leaf.c_str()), NULL, NULL, szFileName, szExt);
    std::_tstring iniName = szFileName;
    iniName += _T(".");
    iniName += INI;
    boost::filesystem::path appFolder;
    path = GetApplicationFolder(appFolder) / stringToPath(iniName);
    return path;
}
Ejemplo n.º 6
0
	bool loadMergedColorFile()
	{
		boost::filesystem::path appFolder;
		GetApplicationFolder(appFolder);
		boost::filesystem::path file = appFolder / stringToPath(ColorFileName(true).GetString());
		if (clib::filesystem::exists(file))
		{
			CategoryLanguageColorMap userColors;
			restore(userColors, file.string().c_str());
			for (CategoryLanguageColorMap::iterator itr = userColors.begin(); itr != userColors.end(); ++itr)
			{
				m_color[itr->first] = itr->second;
			}
			return true;
		}
		return false;
	}
Ejemplo n.º 7
0
	void Save()
	{
		boost::filesystem::path appFolder;
		GetApplicationFolder(appFolder);
		boost::filesystem::path file = appFolder / stringToPath(ColorFileName(true).GetString());

		CategoryLanguageColorMap defaultColors, diffColors;
		loadDefaultColor(defaultColors);
		bool diffFound = false;
		for (CategoryLanguageColorMap::iterator itr = m_color.begin(); itr != m_color.end(); ++itr)
		{
			if (defaultColors[itr->first] != itr->second)
			{
				diffColors[itr->first] = itr->second;
				diffColors[itr->first].Cleanup(&defaultColors[itr->first]);
				diffFound = true;
			}
		}

		if (diffFound)
		{
			save(diffColors, file.string().c_str());
		}
	}