Get number of subdirs in dir path: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Updated author links.) |
||
Line 1: | Line 1: | ||
{|align=right | |||
|<small>Author: [[{{ns:2}}:Afrow UK|Afrow UK]] ([[{{ns:3}}:Afrow UK|talk]], [[{{ns:-1}}:Contributions/Afrow UK|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== Description == | == Description == | ||
This script gets the number of sub dirs in a directory path (string) | This script gets the number of sub dirs in a directory path (string) | ||
Line 40: | Line 44: | ||
-Stu | -Stu | ||
Revision as of 02:58, 30 April 2005
Author: Afrow UK (talk, contrib) |
Description
This script gets the number of sub dirs in a directory path (string) This is useful in conjunction with the UninstallDirs function.
Usage
Push $INSTDIR #input Call SubdirsAmount Pop $R0 ;number of subdirs in $INSTDIR
The Function
Function SubdirsAmount Exch $R0 ;input string Push $R1 Push $R2 Push $R3 Push $R4 StrCpy $R1 0 StrLen $R2 $R0 loop: IntOp $R1 $R1 + 1 StrCpy $R3 $R0 1 -$R1 StrCmp $R1 $R2 exit StrCmp $R3 "\" 0 loop IntOp $R4 $R4 + 1 Goto loop exit: StrCpy $R0 $R4 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 ;output FunctionEnd
Created for tderouin after this topic on the NSIS Forums.
-Stu