Add #ROOTCONFIG# variable

This commit is contained in:
Birunthan Mohanathas 2013-09-15 15:05:06 +03:00
parent 8b68092cf1
commit 08eb662e1f
3 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,7 @@ void ConfigParser::SetBuiltInVariables(const std::wstring& filename, const std::
{ {
insertVariable(L"CURRENTFILE", meterWindow->GetFileName()); insertVariable(L"CURRENTFILE", meterWindow->GetFileName());
insertVariable(L"CURRENTCONFIG", meterWindow->GetFolderPath()); insertVariable(L"CURRENTCONFIG", meterWindow->GetFolderPath());
insertVariable(L"ROOTCONFIG", meterWindow->GetRootName());
insertVariable(L"ROOTCONFIGPATH", meterWindow->GetRootPath()); insertVariable(L"ROOTCONFIGPATH", meterWindow->GetRootPath());
} }

View File

@ -4841,6 +4841,17 @@ std::wstring MeterWindow::GetFilePath()
return file; return file;
} }
std::wstring MeterWindow::GetRootName()
{
std::wstring::size_type loc;
if ((loc = m_FolderPath.find_first_of(L'\\')) != std::wstring::npos)
{
return m_FolderPath.substr(0, loc);
}
return m_FolderPath;
}
std::wstring MeterWindow::GetRootPath() std::wstring MeterWindow::GetRootPath()
{ {
std::wstring path = GetRainmeter().GetSkinPath(); std::wstring path = GetRainmeter().GetSkinPath();

View File

@ -162,6 +162,7 @@ public:
const std::wstring& GetFolderPath() { return m_FolderPath; } const std::wstring& GetFolderPath() { return m_FolderPath; }
const std::wstring& GetFileName() { return m_FileName; } const std::wstring& GetFileName() { return m_FileName; }
std::wstring GetFilePath(); std::wstring GetFilePath();
std::wstring GetRootName();
std::wstring GetRootPath(); std::wstring GetRootPath();
std::wstring GetResourcesPath(); std::wstring GetResourcesPath();
std::wstring GetSkinPath(); std::wstring GetSkinPath();