From 71a560a97ff1b06a2307c3d9e753a27765ec5701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Sat, 5 Mar 2022 11:35:08 +0100 Subject: [PATCH] * Fix conventions for pas2js targets, refactor code to contain less if/then --- ide/lazconf.pp | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/ide/lazconf.pp b/ide/lazconf.pp index 8302a1c35b..ee91bb3506 100644 --- a/ide/lazconf.pp +++ b/ide/lazconf.pp @@ -355,22 +355,30 @@ function GetLibraryExt(TargetOS: string): string; begin if TargetOS='' then TargetOS:=GetCompiledTargetOS; - if CompareText(copy(TargetOS,1,3), 'win') = 0 then + TargetOS:=LowerCase(TargetOS); + if copy(TargetOS,1,3)='win' then Result:='.dll' - else if CompareText(TargetOS, 'darwin') = 0 then - Result:='.dylib' - else if CompareText(TargetOS, 'ios') = 0 then - Result:='.dylib' - else if (CompareText(TargetOS, 'linux') = 0) - or (CompareText(TargetOS, 'android') = 0) - or (CompareText(TargetOS, 'freebsd') = 0) - or (CompareText(TargetOS, 'openbsd') = 0) - or (CompareText(TargetOS, 'netbsd') = 0) - or (CompareText(TargetOS, 'dragonfly') = 0) - or (CompareText(TargetOS, 'haiku') = 0) then - Result:='.so' else - Result:=''; + case TargetOS of + 'darwin', + 'ios': + Result:='.dylib'; + 'linux', + 'android', + 'freebsd', + 'openbsd', + 'netbsd', + 'dragonfly', + 'haiku': + Result:='.so'; + 'browser', + 'nodejs', + 'electron', + 'module': + Result:='.js'; + else + Result:=''; + end; end; function GetLibraryPrefix(TargetOS: string): string; @@ -382,7 +390,7 @@ begin TargetOS:=LowerCase(TargetOS); Result:=''; case TargetOS of - 'browser','nodejs','electron','module': exit('.js'); + 'browser','nodejs','electron','module': exit(''); end; SrcOS:=GetDefaultSrcOSForTargetOS(TargetOS); if CompareText(SrcOS, 'unix') = 0 then