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 {
|
||||
|
||||
FolderInfo::FolderInfo(const wchar_t* aPath)
|
||||
FolderInfo::FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath)
|
||||
{
|
||||
mySubFolderFlag = false;
|
||||
myHiddenFileFlag = false;
|
||||
@ -13,7 +13,7 @@ FolderInfo::FolderInfo(const wchar_t* aPath)
|
||||
myRegExpFilterExtra = NULL;
|
||||
myLastUpdateTime = 0;
|
||||
Clear();
|
||||
SetPath(aPath);
|
||||
SetPath(aPath, aIniPath);
|
||||
}
|
||||
|
||||
void FolderInfo::Clear()
|
||||
@ -23,7 +23,7 @@ void FolderInfo::Clear()
|
||||
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]) {
|
||||
myPath = L"";
|
||||
@ -31,6 +31,18 @@ void FolderInfo::SetPath(const wchar_t* 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'\\') {
|
||||
myPath += L"\\";
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
private:
|
||||
void Clear();
|
||||
void CalculateSize();
|
||||
void SetPath(const wchar_t* aPath);
|
||||
void SetPath(const wchar_t* aPath, const wchar_t* aIniPath);
|
||||
|
||||
public:
|
||||
DWORD GetLastUpdateTime()
|
||||
@ -77,7 +77,7 @@ public:
|
||||
return myFolderCount;
|
||||
}
|
||||
|
||||
FolderInfo(const wchar_t* aPath);
|
||||
FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath);
|
||||
void Update();
|
||||
}; // class FolderInfo
|
||||
|
||||
|
@ -96,7 +96,7 @@ static MeasureInfo* GetMeasureInfo(UINT aId)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static FolderInfo* GetFolderInfo(const wchar_t* aPath)
|
||||
static FolderInfo* GetFolderInfo(const wchar_t* aPath, const wchar_t* aIniPath)
|
||||
{
|
||||
int pathLen = wcslen(aPath);
|
||||
if(pathLen > 2 && L'[' == aPath[0] && L']' == aPath[pathLen - 1]) {
|
||||
@ -110,7 +110,7 @@ static FolderInfo* GetFolderInfo(const wchar_t* aPath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FolderInfo* folderInfo = new FolderInfo(aPath);
|
||||
FolderInfo* folderInfo = new FolderInfo(aPath, aIniPath);
|
||||
sFolderRefCount[folderInfo] = 1;
|
||||
return folderInfo;
|
||||
}
|
||||
@ -136,7 +136,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
||||
MeasureInfo* measureInfo = new MeasureInfo(section);
|
||||
|
||||
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"");
|
||||
for (int i = 0; i < INFOTYPE_COUNT; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user