mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed: FolderInfo.dll did not support relative paths (thanks to elestel)
This commit is contained in:
parent
d125093e89
commit
97bb9c9259
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace PluginFolderInfo {
|
namespace PluginFolderInfo {
|
||||||
|
|
||||||
FolderInfo::FolderInfo(const wchar_t* aPath)
|
FolderInfo::FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath)
|
||||||
{
|
{
|
||||||
mySubFolderFlag = false;
|
mySubFolderFlag = false;
|
||||||
myHiddenFileFlag = false;
|
myHiddenFileFlag = false;
|
||||||
@ -13,7 +13,7 @@ FolderInfo::FolderInfo(const wchar_t* aPath)
|
|||||||
myRegExpFilterExtra = NULL;
|
myRegExpFilterExtra = NULL;
|
||||||
myLastUpdateTime = 0;
|
myLastUpdateTime = 0;
|
||||||
Clear();
|
Clear();
|
||||||
SetPath(aPath);
|
SetPath(aPath, aIniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderInfo::Clear()
|
void FolderInfo::Clear()
|
||||||
@ -23,7 +23,7 @@ void FolderInfo::Clear()
|
|||||||
myFolderCount = 0;
|
myFolderCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderInfo::SetPath(const wchar_t* aPath)
|
void FolderInfo::SetPath(const wchar_t* aPath, const wchar_t* aIniPath)
|
||||||
{
|
{
|
||||||
if (!aPath || 0 == aPath[0]) {
|
if (!aPath || 0 == aPath[0]) {
|
||||||
myPath = L"";
|
myPath = L"";
|
||||||
@ -31,6 +31,18 @@ void FolderInfo::SetPath(const wchar_t* aPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myPath = aPath;
|
myPath = aPath;
|
||||||
|
if (wcsncmp(aPath, L".\\", 2) == 0 || wcsncmp(aPath, L"..\\", 3) == 0) {
|
||||||
|
wchar_t* buf = new wchar_t[wcslen(aIniPath) + 1];
|
||||||
|
wcscpy(buf, aIniPath);
|
||||||
|
wchar_t* iniFileName = wcsrchr(buf, '\\');
|
||||||
|
if (iniFileName) {
|
||||||
|
iniFileName[1] = 0;
|
||||||
|
myPath = buf;
|
||||||
|
myPath += aPath;
|
||||||
|
}
|
||||||
|
delete[] buf;
|
||||||
|
}
|
||||||
|
|
||||||
if (myPath[myPath.size() - 1] != L'\\') {
|
if (myPath[myPath.size() - 1] != L'\\') {
|
||||||
myPath += L"\\";
|
myPath += L"\\";
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
void Clear();
|
void Clear();
|
||||||
void CalculateSize();
|
void CalculateSize();
|
||||||
void SetPath(const wchar_t* aPath);
|
void SetPath(const wchar_t* aPath, const wchar_t* aIniPath);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DWORD GetLastUpdateTime()
|
DWORD GetLastUpdateTime()
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
return myFolderCount;
|
return myFolderCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderInfo(const wchar_t* aPath);
|
FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath);
|
||||||
void Update();
|
void Update();
|
||||||
}; // class FolderInfo
|
}; // class FolderInfo
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ static MeasureInfo* GetMeasureInfo(UINT aId)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FolderInfo* GetFolderInfo(const wchar_t* aPath)
|
static FolderInfo* GetFolderInfo(const wchar_t* aPath, const wchar_t* aIniPath)
|
||||||
{
|
{
|
||||||
int pathLen = wcslen(aPath);
|
int pathLen = wcslen(aPath);
|
||||||
if(pathLen > 2 && L'[' == aPath[0] && L']' == aPath[pathLen - 1]) {
|
if(pathLen > 2 && L'[' == aPath[0] && L']' == aPath[pathLen - 1]) {
|
||||||
@ -110,7 +110,7 @@ static FolderInfo* GetFolderInfo(const wchar_t* aPath)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderInfo* folderInfo = new FolderInfo(aPath);
|
FolderInfo* folderInfo = new FolderInfo(aPath, aIniPath);
|
||||||
sFolderRefCount[folderInfo] = 1;
|
sFolderRefCount[folderInfo] = 1;
|
||||||
return folderInfo;
|
return folderInfo;
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
MeasureInfo* measureInfo = new MeasureInfo(section);
|
MeasureInfo* measureInfo = new MeasureInfo(section);
|
||||||
|
|
||||||
const wchar_t* strFolder = ReadConfigString(section, L"Folder", L"");
|
const wchar_t* strFolder = ReadConfigString(section, L"Folder", L"");
|
||||||
measureInfo->Folder = GetFolderInfo(strFolder);
|
measureInfo->Folder = GetFolderInfo(strFolder, iniFile);
|
||||||
|
|
||||||
const wchar_t* strInfoType = ReadConfigString(section, L"InfoType", L"");
|
const wchar_t* strInfoType = ReadConfigString(section, L"InfoType", L"");
|
||||||
for (int i = 0; i < INFOTYPE_COUNT; i++) {
|
for (int i = 0; i < INFOTYPE_COUNT; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user