Archive: using FileFunc in a macro


using FileFunc in a macro
  i'm currently polishing up a macro to get the name of a Type1 font and to install it. as my current code requires a macro from FileFunc.nsh, i was wondering if anything speaks against the usage of the following inside my macro

!ifndef FILEFUNC_INCLUDED

!include FileFunc.nsh
!insertmacro GetBaseName
!insertmacro GetParent
>!endif

If FileFunc was included, but the 2 macros weren't, then you might still have problem.

Because of how FileFunc.nsh is structured, included it more than once shouldn't cause a problem.

Here's a method I'd used in a few of my scripts:


define AddFileFunc FuncName


>!macro AddFileFunc FuncName
!ifmacrondef ${FuncName}
!includeFileFunc.nsh
!insertmacro ${FuncName}
!endif
!macroend
>
Then, to insert the functions, just add this:

GetBaseName

>${AddFileFunc} GetParent
>

oops... I should have used !ifndef. So the first code should be like this:


macro AddFileFunc FuncName

!ifndef ${FuncName}
!includeFileFunc.nsh
!insertmacro ${FuncName}
!endif
!macroend
>

oh thanks, didn't think of that. also good to know there's no problem working like that.