mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Additional change to cb0fd82
This commit is contained in:
parent
cb0fd823e7
commit
9fb14b032c
@ -51,7 +51,7 @@ CConfigParser::~CConfigParser()
|
||||
{
|
||||
}
|
||||
|
||||
void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR config)
|
||||
void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR config, const std::wstring* includePath)
|
||||
{
|
||||
m_Measures.clear();
|
||||
m_Sections.clear();
|
||||
@ -73,14 +73,7 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
|
||||
|
||||
CSystem::UpdateIniFileMappingList();
|
||||
|
||||
std::wstring resourcePath;
|
||||
if (meterWindow)
|
||||
{
|
||||
resourcePath = meterWindow->GetSkinRootPath();
|
||||
resourcePath += L"@Resources\\";
|
||||
}
|
||||
|
||||
ReadIniFile(filename, resourcePath, config);
|
||||
ReadIniFile(filename, includePath, config);
|
||||
ReadVariables();
|
||||
|
||||
// Clear and minimize
|
||||
@ -1155,7 +1148,7 @@ RECT CConfigParser::ParseRECT(LPCTSTR string)
|
||||
** Reads the given ini file and fills the m_Values and m_Keys maps.
|
||||
**
|
||||
*/
|
||||
void CConfigParser::ReadIniFile(const std::wstring& iniFile, const std::wstring& resourcePath, LPCTSTR config, int depth)
|
||||
void CConfigParser::ReadIniFile(const std::wstring& iniFile, const std::wstring* includePath, LPCTSTR config, int depth)
|
||||
{
|
||||
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
||||
{
|
||||
@ -1319,10 +1312,10 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, const std::wstring&
|
||||
ReplaceVariables(value);
|
||||
if (!CSystem::IsAbsolutePath(value))
|
||||
{
|
||||
if (!resourcePath.empty() &&
|
||||
if (includePath &&
|
||||
value[0] == L'@' && value[1] == L'\\') // value[1] == L'\0' if value.size() == 1
|
||||
{
|
||||
value.replace(0, 2, resourcePath);
|
||||
value.replace(0, 2, *includePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1330,7 +1323,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, const std::wstring&
|
||||
value.insert(0, CRainmeter::ExtractPath(iniFile));
|
||||
}
|
||||
}
|
||||
ReadIniFile(value, resourcePath, config, depth + 1);
|
||||
ReadIniFile(value, includePath, config, depth + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
CConfigParser();
|
||||
~CConfigParser();
|
||||
|
||||
void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR config = NULL);
|
||||
void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR config = NULL, const std::wstring* includePath = NULL);
|
||||
void AddMeasure(CMeasure* pMeasure);
|
||||
|
||||
bool GetVariable(const std::wstring& strVariable, std::wstring& strValue);
|
||||
@ -106,7 +106,7 @@ private:
|
||||
|
||||
CMeasure* GetMeasure(const std::wstring& name);
|
||||
|
||||
void ReadIniFile(const std::wstring& iniFile, const std::wstring& resourcePath, LPCTSTR config = NULL, int depth = 0);
|
||||
void ReadIniFile(const std::wstring& iniFile, const std::wstring* includePath, LPCTSTR config = NULL, int depth = 0);
|
||||
|
||||
void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);
|
||||
|
||||
|
@ -1959,18 +1959,10 @@ bool CMeterWindow::ReadSkin()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring::size_type suiteLen;
|
||||
if ((suiteLen = m_SkinName.find_first_of(L'\\')) == std::wstring::npos)
|
||||
{
|
||||
suiteLen = m_SkinName.size();
|
||||
}
|
||||
|
||||
std::wstring resourcePath = Rainmeter->GetSkinPath();
|
||||
resourcePath.append(m_SkinName, 0, suiteLen);
|
||||
resourcePath += L"\\@Resources\\";
|
||||
std::wstring resourcePath = GetSkinResourcesPath();
|
||||
m_ResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0);
|
||||
|
||||
m_Parser.Initialize(iniFile, this);
|
||||
m_Parser.Initialize(iniFile, this, NULL, &resourcePath);
|
||||
|
||||
// Check the version
|
||||
UINT appVersion = m_Parser.ReadUInt(L"Rainmeter", L"AppVersion", 0);
|
||||
@ -4744,6 +4736,13 @@ std::wstring CMeterWindow::GetSkinRootPath()
|
||||
return path;
|
||||
}
|
||||
|
||||
std::wstring CMeterWindow::GetSkinResourcesPath()
|
||||
{
|
||||
std::wstring path = GetSkinRootPath();
|
||||
path += L"@Resources\\";
|
||||
return path;
|
||||
}
|
||||
|
||||
CMeter* CMeterWindow::GetMeter(const std::wstring& meterName)
|
||||
{
|
||||
const WCHAR* name = meterName.c_str();
|
||||
|
@ -205,6 +205,7 @@ public:
|
||||
const std::wstring& GetSkinIniFile() { return m_SkinIniFile; }
|
||||
std::wstring GetSkinFilePath();
|
||||
std::wstring GetSkinRootPath();
|
||||
std::wstring GetSkinResourcesPath();
|
||||
|
||||
std::list<CMeasure*>& GetMeasures() { return m_Measures; }
|
||||
std::list<CMeter*>& GetMeters() { return m_Meters; }
|
||||
|
@ -2136,6 +2136,14 @@ void CRainmeter::ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow,
|
||||
{
|
||||
std::wstring tmpSz = command;
|
||||
meterWindow->GetParser().ReplaceMeasures(tmpSz);
|
||||
|
||||
std::wstring::size_type pos = tmpSz.find_first_not_of(L" \t\"");
|
||||
if (pos != std::wstring::npos &&
|
||||
tmpSz[pos] == L'@' && tmpSz[pos + 1] == L'\\') // tmpSz[pos + 1] == L'\0' if tmpSz.size() == 1
|
||||
{
|
||||
tmpSz.replace(pos, 2, meterWindow->GetSkinResourcesPath());
|
||||
}
|
||||
|
||||
RunCommand(NULL, tmpSz.c_str(), SW_SHOWNORMAL);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user