mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Reverted r815 and stopped changing the working directory for the plugins.
This commit is contained in:
parent
7ae737fc0f
commit
31e3091e34
@ -68,15 +68,6 @@ bool CMeasurePlugin::Update()
|
|||||||
{
|
{
|
||||||
if (!CMeasure::PreUpdate()) return false;
|
if (!CMeasure::PreUpdate()) return false;
|
||||||
|
|
||||||
bool bulkUpdating = (m_MeterWindow && m_MeterWindow->IsBulkUpdating());
|
|
||||||
|
|
||||||
if (!bulkUpdating)
|
|
||||||
{
|
|
||||||
std::wstring dir = Rainmeter->GetSkinPath();
|
|
||||||
if (m_MeterWindow) dir += m_MeterWindow->GetSkinName();
|
|
||||||
CSystem::SetWorkingDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UpdateFunc)
|
if (UpdateFunc)
|
||||||
{
|
{
|
||||||
// Update the plugin
|
// Update the plugin
|
||||||
@ -88,10 +79,8 @@ bool CMeasurePlugin::Update()
|
|||||||
m_Value = UpdateFunc2(m_ID);
|
m_Value = UpdateFunc2(m_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bulkUpdating)
|
// Reset to default
|
||||||
{
|
CSystem::ResetWorkingDirectory();
|
||||||
CSystem::ResetWorkingDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
return PostUpdate();
|
return PostUpdate();
|
||||||
}
|
}
|
||||||
@ -186,13 +175,11 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
// Remove current directory from DLL search path
|
// Remove current directory from DLL search path
|
||||||
SetDllDirectory(L"");
|
SetDllDirectory(L"");
|
||||||
|
|
||||||
std::wstring dir = Rainmeter->GetSkinPath();
|
|
||||||
if (m_MeterWindow) dir += m_MeterWindow->GetSkinName();
|
|
||||||
CSystem::SetWorkingDirectory(dir);
|
|
||||||
|
|
||||||
double maxValue;
|
double maxValue;
|
||||||
maxValue = InitializeFunc(m_Plugin, parser.GetFilename().c_str(), section, m_ID);
|
maxValue = InitializeFunc(m_Plugin, parser.GetFilename().c_str(), section, m_ID);
|
||||||
|
|
||||||
|
// Reset to default
|
||||||
|
SetDllDirectory(L"");
|
||||||
CSystem::ResetWorkingDirectory();
|
CSystem::ResetWorkingDirectory();
|
||||||
|
|
||||||
std::wstring szMaxValue = parser.ReadString(section, L"MaxValue", L"NotSet");
|
std::wstring szMaxValue = parser.ReadString(section, L"MaxValue", L"NotSet");
|
||||||
|
@ -99,7 +99,6 @@ CMeterWindow::CMeterWindow(const std::wstring& path, const std::wstring& config,
|
|||||||
m_TransitionUpdate(100),
|
m_TransitionUpdate(100),
|
||||||
m_ActiveTransition(false),
|
m_ActiveTransition(false),
|
||||||
m_HasNetMeasures(false),
|
m_HasNetMeasures(false),
|
||||||
m_HasPluginMeasures(false),
|
|
||||||
m_HasButtons(false),
|
m_HasButtons(false),
|
||||||
m_WindowHide(HIDEMODE_NONE),
|
m_WindowHide(HIDEMODE_NONE),
|
||||||
m_WindowStartHidden(false),
|
m_WindowStartHidden(false),
|
||||||
@ -127,7 +126,6 @@ CMeterWindow::CMeterWindow(const std::wstring& path, const std::wstring& config,
|
|||||||
m_FadeEndValue(),
|
m_FadeEndValue(),
|
||||||
m_TransparencyValue(),
|
m_TransparencyValue(),
|
||||||
m_Refreshing(false),
|
m_Refreshing(false),
|
||||||
m_BulkUpdating(false),
|
|
||||||
m_Hidden(false),
|
m_Hidden(false),
|
||||||
m_ResetRegion(false),
|
m_ResetRegion(false),
|
||||||
m_UpdateCounter(),
|
m_UpdateCounter(),
|
||||||
@ -2113,7 +2111,6 @@ bool CMeterWindow::ReadSkin()
|
|||||||
// Create the meters and measures
|
// Create the meters and measures
|
||||||
|
|
||||||
m_HasNetMeasures = false;
|
m_HasNetMeasures = false;
|
||||||
m_HasPluginMeasures = false;
|
|
||||||
m_HasButtons = false;
|
m_HasButtons = false;
|
||||||
|
|
||||||
// Get all the sections (i.e. different meters, measures and the other stuff)
|
// Get all the sections (i.e. different meters, measures and the other stuff)
|
||||||
@ -2156,11 +2153,6 @@ bool CMeterWindow::ReadSkin()
|
|||||||
{
|
{
|
||||||
m_HasNetMeasures = true;
|
m_HasNetMeasures = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_HasPluginMeasures && dynamic_cast<CMeasurePlugin*>(measure))
|
|
||||||
{
|
|
||||||
m_HasPluginMeasures = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2832,8 +2824,6 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
{
|
{
|
||||||
++m_UpdateCounter;
|
++m_UpdateCounter;
|
||||||
|
|
||||||
m_BulkUpdating = true;
|
|
||||||
|
|
||||||
if (!m_Measures.empty())
|
if (!m_Measures.empty())
|
||||||
{
|
{
|
||||||
// Pre-updates
|
// Pre-updates
|
||||||
@ -2841,15 +2831,11 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
CMeasureCalc::UpdateVariableMap(*this);
|
CMeasureCalc::UpdateVariableMap(*this);
|
||||||
|
|
||||||
// Update all measures
|
// Update all measures
|
||||||
if (m_HasPluginMeasures) CSystem::SetWorkingDirectory(m_SkinPath + m_SkinName);
|
|
||||||
|
|
||||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||||
for ( ; i != m_Measures.end(); ++i)
|
for ( ; i != m_Measures.end(); ++i)
|
||||||
{
|
{
|
||||||
UpdateMeasure((*i), false);
|
UpdateMeasure((*i), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_HasPluginMeasures) CSystem::ResetWorkingDirectory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update all meters
|
// Update all meters
|
||||||
@ -2884,8 +2870,6 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
// Post-updates
|
// Post-updates
|
||||||
PostUpdate(bActiveTransition);
|
PostUpdate(bActiveTransition);
|
||||||
|
|
||||||
m_BulkUpdating = false;
|
|
||||||
|
|
||||||
// if (m_MeasuresToVariables) // BUG: LSSetVariable doens't seem to work for some reason.
|
// if (m_MeasuresToVariables) // BUG: LSSetVariable doens't seem to work for some reason.
|
||||||
// {
|
// {
|
||||||
// std::list<CMeasure*>::iterator i = m_Measures.begin();
|
// std::list<CMeasure*>::iterator i = m_Measures.begin();
|
||||||
|
@ -182,8 +182,6 @@ public:
|
|||||||
void Refresh(bool init, bool all = false);
|
void Refresh(bool init, bool all = false);
|
||||||
void Redraw();
|
void Redraw();
|
||||||
|
|
||||||
bool IsBulkUpdating() { return m_BulkUpdating; }
|
|
||||||
|
|
||||||
void SetMouseLeaveEvent(bool cancel);
|
void SetMouseLeaveEvent(bool cancel);
|
||||||
|
|
||||||
void MoveWindow(int x, int y);
|
void MoveWindow(int x, int y);
|
||||||
@ -385,7 +383,6 @@ private:
|
|||||||
int m_TransitionUpdate; // Transition redraw frequency
|
int m_TransitionUpdate; // Transition redraw frequency
|
||||||
bool m_ActiveTransition;
|
bool m_ActiveTransition;
|
||||||
bool m_HasNetMeasures;
|
bool m_HasNetMeasures;
|
||||||
bool m_HasPluginMeasures;
|
|
||||||
bool m_HasButtons;
|
bool m_HasButtons;
|
||||||
HIDEMODE m_WindowHide; // If true, the window is hidden when mouse is over it
|
HIDEMODE m_WindowHide; // If true, the window is hidden when mouse is over it
|
||||||
bool m_WindowStartHidden; // If true, the window is hidden at startup
|
bool m_WindowStartHidden; // If true, the window is hidden at startup
|
||||||
@ -418,7 +415,6 @@ private:
|
|||||||
int m_TransparencyValue;
|
int m_TransparencyValue;
|
||||||
|
|
||||||
bool m_Refreshing; // This is true, when the meter is refreshing
|
bool m_Refreshing; // This is true, when the meter is refreshing
|
||||||
bool m_BulkUpdating;
|
|
||||||
|
|
||||||
bool m_Hidden; // True, if Rainmeter is hidden
|
bool m_Hidden; // True, if Rainmeter is hidden
|
||||||
bool m_ResetRegion; // If true, the window region is recalculated during the next update
|
bool m_ResetRegion; // If true, the window region is recalculated during the next update
|
||||||
|
@ -120,14 +120,6 @@ void CSystem::Initialize(HINSTANCE instance)
|
|||||||
WCHAR directory[MAX_PATH] = {0};
|
WCHAR directory[MAX_PATH] = {0};
|
||||||
GetCurrentDirectory(MAX_PATH, directory);
|
GetCurrentDirectory(MAX_PATH, directory);
|
||||||
c_WorkingDirectory = directory;
|
c_WorkingDirectory = directory;
|
||||||
if (!c_WorkingDirectory.empty())
|
|
||||||
{
|
|
||||||
WCHAR ch = c_WorkingDirectory[c_WorkingDirectory.size() - 1];
|
|
||||||
if (ch != L'\\' && ch != L'/')
|
|
||||||
{
|
|
||||||
c_WorkingDirectory += L"\\";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL);
|
SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL);
|
||||||
SetTimer(c_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL);
|
SetTimer(c_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL);
|
||||||
@ -999,6 +991,23 @@ HMODULE CSystem::RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError, bool ignor
|
|||||||
return hLib;
|
return hLib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** ResetWorkingDirectory
|
||||||
|
**
|
||||||
|
** Resets working directory to default.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void CSystem::ResetWorkingDirectory()
|
||||||
|
{
|
||||||
|
WCHAR directory[MAX_PATH] = {0};
|
||||||
|
GetCurrentDirectory(MAX_PATH, directory);
|
||||||
|
|
||||||
|
if (_wcsicmp(directory, c_WorkingDirectory.c_str()) != 0)
|
||||||
|
{
|
||||||
|
SetCurrentDirectory(c_WorkingDirectory.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CopyFiles
|
** CopyFiles
|
||||||
**
|
**
|
||||||
|
@ -74,9 +74,7 @@ public:
|
|||||||
static OSPLATFORM GetOSPlatform();
|
static OSPLATFORM GetOSPlatform();
|
||||||
|
|
||||||
static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = NULL, bool ignoreErrors = false);
|
static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = NULL, bool ignoreErrors = false);
|
||||||
|
static void ResetWorkingDirectory();
|
||||||
static void SetWorkingDirectory(const std::wstring& directory) { SetCurrentDirectory(directory.c_str()); }
|
|
||||||
static void ResetWorkingDirectory() { SetWorkingDirectory(c_WorkingDirectory); }
|
|
||||||
|
|
||||||
static bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMove = false);
|
static bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMove = false);
|
||||||
static bool RemoveFile(const std::wstring& file);
|
static bool RemoveFile(const std::wstring& file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user