mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Changed @\ to #@#
This commit is contained in:
parent
1537bf4ee8
commit
4558c2836c
@ -51,7 +51,7 @@ CConfigParser::~CConfigParser()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR config, const std::wstring* includePath)
|
void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR config, const std::wstring* resourcePath)
|
||||||
{
|
{
|
||||||
m_Measures.clear();
|
m_Measures.clear();
|
||||||
m_Sections.clear();
|
m_Sections.clear();
|
||||||
@ -68,12 +68,12 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
|
|||||||
m_CurrentSection = NULL;
|
m_CurrentSection = NULL;
|
||||||
|
|
||||||
// Set the built-in variables. Do this before the ini file is read so that the paths can be used with @include
|
// Set the built-in variables. Do this before the ini file is read so that the paths can be used with @include
|
||||||
SetBuiltInVariables(filename, meterWindow);
|
SetBuiltInVariables(filename, resourcePath, meterWindow);
|
||||||
ResetMonitorVariables(meterWindow);
|
ResetMonitorVariables(meterWindow);
|
||||||
|
|
||||||
CSystem::UpdateIniFileMappingList();
|
CSystem::UpdateIniFileMappingList();
|
||||||
|
|
||||||
ReadIniFile(filename, includePath, config);
|
ReadIniFile(filename, config);
|
||||||
ReadVariables();
|
ReadVariables();
|
||||||
|
|
||||||
// Clear and minimize
|
// Clear and minimize
|
||||||
@ -81,7 +81,7 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
|
|||||||
m_ListVariables.clear();
|
m_ListVariables.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::SetBuiltInVariables(const std::wstring& filename, CMeterWindow* meterWindow)
|
void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, CMeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
SetBuiltInVariable(L"PROGRAMPATH", Rainmeter->GetPath());
|
SetBuiltInVariable(L"PROGRAMPATH", Rainmeter->GetPath());
|
||||||
SetBuiltInVariable(L"PROGRAMDRIVE", Rainmeter->GetDrive());
|
SetBuiltInVariable(L"PROGRAMDRIVE", Rainmeter->GetDrive());
|
||||||
@ -91,6 +91,11 @@ void CConfigParser::SetBuiltInVariables(const std::wstring& filename, CMeterWind
|
|||||||
SetBuiltInVariable(L"CURRENTPATH", CRainmeter::ExtractPath(filename));
|
SetBuiltInVariable(L"CURRENTPATH", CRainmeter::ExtractPath(filename));
|
||||||
SetBuiltInVariable(L"ADDONSPATH", Rainmeter->GetAddonPath());
|
SetBuiltInVariable(L"ADDONSPATH", Rainmeter->GetAddonPath());
|
||||||
|
|
||||||
|
if (resourcePath)
|
||||||
|
{
|
||||||
|
SetBuiltInVariable(L"@", *resourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
SetBuiltInVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile());
|
SetBuiltInVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile());
|
||||||
@ -1148,7 +1153,7 @@ RECT CConfigParser::ParseRECT(LPCTSTR string)
|
|||||||
** Reads the given ini file and fills the m_Values and m_Keys maps.
|
** Reads the given ini file and fills the m_Values and m_Keys maps.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::ReadIniFile(const std::wstring& iniFile, const std::wstring* includePath, LPCTSTR config, int depth)
|
void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int depth)
|
||||||
{
|
{
|
||||||
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
||||||
{
|
{
|
||||||
@ -1312,18 +1317,10 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, const std::wstring*
|
|||||||
ReplaceVariables(value);
|
ReplaceVariables(value);
|
||||||
if (!CSystem::IsAbsolutePath(value))
|
if (!CSystem::IsAbsolutePath(value))
|
||||||
{
|
{
|
||||||
if (includePath &&
|
// Relative to the ini folder
|
||||||
value[0] == L'@' && value[1] == L'\\') // value[1] == L'\0' if value.size() == 1
|
value.insert(0, CRainmeter::ExtractPath(iniFile));
|
||||||
{
|
|
||||||
value.replace(0, 2, *includePath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Relative to the ini folder
|
|
||||||
value.insert(0, CRainmeter::ExtractPath(iniFile));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ReadIniFile(value, includePath, config, depth + 1);
|
ReadIniFile(value, config, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
CConfigParser();
|
CConfigParser();
|
||||||
~CConfigParser();
|
~CConfigParser();
|
||||||
|
|
||||||
void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR config = NULL, const std::wstring* includePath = NULL);
|
void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR config = NULL, const std::wstring* resourcePath = NULL);
|
||||||
void AddMeasure(CMeasure* pMeasure);
|
void AddMeasure(CMeasure* pMeasure);
|
||||||
|
|
||||||
bool GetVariable(const std::wstring& strVariable, std::wstring& strValue);
|
bool GetVariable(const std::wstring& strVariable, std::wstring& strValue);
|
||||||
@ -100,13 +100,13 @@ public:
|
|||||||
static void UpdateWorkareaVariables() { SetMultiMonitorVariables(false); }
|
static void UpdateWorkareaVariables() { SetMultiMonitorVariables(false); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetBuiltInVariables(const std::wstring& filename, CMeterWindow* meterWindow);
|
void SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, CMeterWindow* meterWindow);
|
||||||
|
|
||||||
void ReadVariables();
|
void ReadVariables();
|
||||||
|
|
||||||
CMeasure* GetMeasure(const std::wstring& name);
|
CMeasure* GetMeasure(const std::wstring& name);
|
||||||
|
|
||||||
void ReadIniFile(const std::wstring& iniFile, const std::wstring* includePath, LPCTSTR config = NULL, int depth = 0);
|
void ReadIniFile(const std::wstring& iniFile, LPCTSTR config = NULL, int depth = 0);
|
||||||
|
|
||||||
void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);
|
void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);
|
||||||
|
|
||||||
|
@ -4677,32 +4677,11 @@ void CMeterWindow::MakePathAbsolute(std::wstring& path)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring absolute;
|
std::wstring absolute;
|
||||||
|
absolute.reserve(Rainmeter->GetSkinPath().size() + m_SkinName.size() + 1 + path.size());
|
||||||
if (path[0] == L'@' && path[1] == L'\\') // path[1] == L'\0' if path.size() == 1
|
absolute = Rainmeter->GetSkinPath();
|
||||||
{
|
absolute += m_SkinName;
|
||||||
const std::wstring::size_type resourcesLen = 13; // Count of "\\@Resources\\"
|
absolute += L'\\';
|
||||||
|
absolute += path;
|
||||||
std::wstring::size_type suiteLen;
|
|
||||||
if ((suiteLen = m_SkinName.find_first_of(L'\\')) == std::wstring::npos)
|
|
||||||
{
|
|
||||||
suiteLen = m_SkinName.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
absolute.reserve(Rainmeter->GetSkinPath().size() + suiteLen + resourcesLen + (path.size() - 2));
|
|
||||||
absolute = Rainmeter->GetSkinPath();
|
|
||||||
absolute.append(m_SkinName, 0, suiteLen);
|
|
||||||
absolute += L"\\@Resources\\";
|
|
||||||
absolute.append(path, 2, path.length() - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
absolute.reserve(Rainmeter->GetSkinPath().size() + m_SkinName.size() + 1 + path.size());
|
|
||||||
absolute = Rainmeter->GetSkinPath();
|
|
||||||
absolute += m_SkinName;
|
|
||||||
absolute += L'\\';
|
|
||||||
absolute += path;
|
|
||||||
}
|
|
||||||
|
|
||||||
absolute.swap(path);
|
absolute.swap(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2139,14 +2139,6 @@ void CRainmeter::ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow,
|
|||||||
{
|
{
|
||||||
std::wstring tmpSz = command;
|
std::wstring tmpSz = command;
|
||||||
meterWindow->GetParser().ReplaceMeasures(tmpSz);
|
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);
|
RunCommand(NULL, tmpSz.c_str(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user