mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	New build in variables: #PROGRAMPATH#, #SETTINGSPATH#, #SKINSPATH#, #PLUGINSPATH#, #ADDONSPATH# and #CURRENTPATH# (this is the path where the ini file that is currently read is located).
If there is a file called Default.ini in the program folder it will be used as the default settings file for new users. The location of the settings file (rainmeter.ini) can be defined as a command line argument.
This commit is contained in:
		| @@ -53,9 +53,23 @@ CConfigParser::~CConfigParser() | ||||
| ** | ||||
| ** | ||||
| */ | ||||
| void CConfigParser::Initialize(LPCTSTR filename) | ||||
| void CConfigParser::Initialize(LPCTSTR filename, CRainmeter* pRainmeter) | ||||
| { | ||||
| 	m_Filename = filename; | ||||
|  | ||||
| 	m_Variables.clear(); | ||||
|  | ||||
| 	// Set the paths as default variables | ||||
| 	if (pRainmeter) | ||||
| 	{ | ||||
| 		m_Variables[L"PROGRAMPATH"] = pRainmeter->GetPath(); | ||||
| 		m_Variables[L"SETTINGSPATH"] = pRainmeter->GetSettingsPath(); | ||||
| 		m_Variables[L"SKINSPATH"] = pRainmeter->GetSkinPath(); | ||||
| 		m_Variables[L"PLUGINSPATH"] = pRainmeter->GetPluginPath(); | ||||
| 		m_Variables[L"CURRENTPATH"] = CRainmeter::ExtractPath(filename); | ||||
| 		m_Variables[L"ADDONSPATH"] = pRainmeter->GetPath() + L"Addons\\"; | ||||
| 	} | ||||
|  | ||||
| 	ReadVariables(); | ||||
| } | ||||
|  | ||||
| @@ -72,7 +86,6 @@ void CConfigParser::ReadVariables() | ||||
| 	int bufferSize = 4096; | ||||
| 	bool loop; | ||||
|  | ||||
| 	m_Variables.clear(); | ||||
| 	do  | ||||
| 	{ | ||||
| 		loop = false; | ||||
| @@ -175,21 +188,7 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if (result.find(L'%') != std::wstring::npos)  | ||||
| 	{ | ||||
| 		WCHAR buffer[4096];	// lets hope the buffer is large enough... | ||||
|  | ||||
| 		// Expand the environment variables | ||||
| 		DWORD ret = ExpandEnvironmentStrings(result.c_str(), buffer, 4096); | ||||
| 		if (ret != 0 && ret < 4096) | ||||
| 		{ | ||||
| 			result = buffer; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			DebugLog(L"Unable to expand the environment strings."); | ||||
| 		} | ||||
| 	} | ||||
| 	result = CRainmeter::ExpandEnvironmentVariables(result); | ||||
|  | ||||
| 	// Check for variables (#VAR#) | ||||
| 	size_t start = 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kimmo Pekkola
					Kimmo Pekkola