Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th July 2008, 21:05   #1
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,169
Send a message via ICQ to Yathosho
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

PHP Code:
!ifndef FILEFUNC_INCLUDED
  
!include FileFunc.nsh
  
!insertmacro GetBaseName
  
!insertmacro GetParent
!endif 
Yathosho is online now   Reply With Quote
Old 24th July 2008, 21:46   #2
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
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:

PHP Code:
!define AddFileFunc FuncName

!macro AddFileFunc FuncName
  
!ifmacrondef ${FuncName}
    !include 
FileFunc.nsh
    
!insertmacro ${FuncName}
  !endif
!
macroend 
Then, to insert the functions, just add this:
PHP Code:
${AddFileFuncGetBaseName
${AddFileFuncGetParent 
Comperio is offline   Reply With Quote
Old 24th July 2008, 21:52   #3
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
oops... I should have used !ifndef. So the first code should be like this:
PHP Code:
!macro AddFileFunc FuncName
  
!ifndef ${FuncName}
    !include 
FileFunc.nsh
    
!insertmacro ${FuncName}
  !endif
!
macroend 
Comperio is offline   Reply With Quote
Old 24th July 2008, 23:07   #4
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,169
Send a message via ICQ to Yathosho
oh thanks, didn't think of that. also good to know there's no problem working like that.
Yathosho is online now   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump