From 29ceb68e4166d276aa910ddc9baa661edf652e57 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 22 Jan 2022 16:49:41 +0300 Subject: mRadio to read ini file from Plugins/mRadio folder instead of Plugins itself --- plugins/mRadio/mradio.dpr | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'plugins') diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr index d2dea8e725..6e9f7b5951 100644 --- a/plugins/mRadio/mradio.dpr +++ b/plugins/mRadio/mradio.dpr @@ -31,24 +31,17 @@ uses function OnModulesLoaded(wParam:WPARAM;lParam:LPARAM):int;cdecl; var nlu:TNETLIBUSER; - buf:array [0..MAX_PATH-1] of WideChar; - szTemp:array [0..255] of AnsiChar absolute buf; - pc:pWideChar; + buf:PWideChar; + szTemp:array [0..255] of AnsiChar; begin - // buf = miranda directory - // must be same as %miranda_path% of MS_UTILS_REPLACEVARS - - GetModuleFileNameW(0,buf,MAX_PATH-1); - pc:=StrEndW(buf); - repeat - dec(pc); - until pc^='\'; - inc(pc); - pc^:=#0; - - // INI file path - StrCopyW(pc,'plugins\mradio.ini'); + buf:=Utils_ReplaceVarsW('%miranda_path%\plugins\mradio\mradio.ini'); + if (GetFileAttributesW(buf) = $FFFFFFFF) then begin + mir_free(buf); + buf:=Utils_ReplaceVarsW('%miranda_path%\plugins\mradio.ini'); + end; FastWideToAnsi(buf,storage); + mir_free(buf); + mGetMem(storagep,MAX_PATH+32); Profile_GetPathA(MAX_PATH,storagep); StrCat(storagep,'\mradio.ini'); -- cgit v1.2.3