From c8b35fb6166c87d98e7e8c17f27d67a382c38713 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Mon, 21 May 2012 12:08:31 +0300 Subject: [PATCH] Fixed relative paths with !SetWallpaper --- Library/Rainmeter.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 04a527db..e524f201 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -427,15 +427,20 @@ void CRainmeter::Bang_SetClip(std::vector& args) ** !SetWallpaper bang ** */ -void CRainmeter::Bang_SetWallpaper(std::vector& args) +void CRainmeter::Bang_SetWallpaper(std::vector& args, CMeterWindow* meterWindow) { - if (args.size() == 1) + const size_t argsSize = args.size(); + if (argsSize >= 1 && argsSize <= 2) { - CSystem::SetWallpaper(args[0], L""); - } - else if (args.size() == 2) - { - CSystem::SetWallpaper(args[0], args[1]); + std::wstring& file = args[0]; + const std::wstring& style = (argsSize == 2) ? args[1] : L""; + + if (meterWindow) + { + meterWindow->MakePathAbsolute(file); + } + + CSystem::SetWallpaper(file, style); } else {