DirState: 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}}:Instructor|Instructor]] ([[{{ns:3}}:Instructor|talk]], [[{{ns:-1}}:Contributions/Instructor|contrib]])</small>
|}
<br style="clear:both;">
== Links ==
== Links ==
; Latest version of headers "nsh.zip":
; Latest version of headers "nsh.zip":
Line 60: Line 64:
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
Page author: [[User:Instructor|Instructor]]

Revision as of 02:55, 30 April 2005

Author: Instructor (talk, contrib)


Links

Latest version of headers "nsh.zip"
http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost

If function used without header then put function in script before call it

The Function

/*
____________________________________________________________________________
 
                            DirState
____________________________________________________________________________
 
2004 Shengalts Aleksander (Shengalts@mail.ru)
 
 
Check directory full or empty.
 
 
Syntax:
Push "[path]"      ; [path]
                   ;   Directory
Call DirState      ; Call function
                   ;
Pop $var           ; $var=0  (empty)
                   ; $var=1  (full)
                   ; $var=-1 (directory not found)
 
 
Example:
Section
	Push "$TEMP"
	Call DirState
	Pop $R0   ; $R0="1"  directory is full
SectionEnd*/
 
 
;---------------------------------------------------------------------------
Function DirState
	Exch $0
	Push $1
 
	FindFirst $1 $0 '$0\*.*'
	IfErrors 0 +3
	StrCpy $0 -1
	goto end
	StrCmp $0 '.' 0 +4
	FindNext $1 $0
	StrCmp $0 '..' 0 +2
	FindNext $1 $0
	FindClose $1
	IfErrors 0 +3
	StrCpy $0 0
	goto end
	StrCpy $0 1
 
	end:
	Pop $1
	Exch $0
FunctionEnd