diff options
author | George Hazan <ghazan@miranda.im> | 2022-01-22 16:49:41 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-01-22 16:49:41 +0300 |
commit | 29ceb68e4166d276aa910ddc9baa661edf652e57 (patch) | |
tree | f2d0376d5af0d851e467130f2e8fd48438c59096 | |
parent | 25ae47d035f0f23c763d7fb7a7dac9fa9d0e65f4 (diff) |
mRadio to read ini file from Plugins/mRadio folder instead of Plugins itself
-rw-r--r-- | plugins/mRadio/mradio.dpr | 25 |
1 files changed, 9 insertions, 16 deletions
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');
|