home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Firefox / FirefoxPortable_20.0_French.paf.exe / Other / Source / SetFileAttributesDirectoryNormal.nsh < prev   
Text File  |  2010-06-22  |  1KB  |  49 lines

  1. ∩╗┐; SetFileAttributesDirectoryNormal v 1.1
  2. ; Sets all the files in a given directory (and sub directories) to NORMAL attributes
  3. ;
  4. ; Usage: ${SetFileAttributesDirectoryNormal} DIRECTORY_TO_SET_NORMAL
  5. ;
  6. ; Macro and Define added by John T. Haller of PortableApps.com
  7. ;
  8. ; Uses function Attrib v1.1
  9. ; http://nsis.sourceforge.net/Attrib
  10. ; By: Hendri Adriaens (HendriAdriaens@hotmail.com)
  11. ; Additions by hobbyscripter to enable recursion of sub-directories
  12. ; BSD License
  13.  
  14. Function SetFileAttributesDirectoryNormal
  15.     Exch $1 ; Dir
  16.     Push $2
  17.     Push $3
  18.     FindFirst $2 $3 "$1\*.*"
  19.     StrCmp $3 "" exitloop
  20.     
  21.     loop:
  22.         StrCmp $3 "" exitloop
  23.         StrCmp $3 "." next
  24.         StrCmp $3 ".." next
  25.         IfFileExists "$1\$3\*.*" 0 +4
  26.             Push "$1\$3"
  27.             Call SetFileAttributesDirectoryNormal
  28.             Goto next
  29.         ; SetFileAttributes does not accept variables as attribute,
  30.         ; so manually set this to the necessary value.
  31.         SetFileAttributes "$1\$3" NORMAL
  32.         
  33.     next:
  34.         FindNext $2 $3
  35.         Goto loop
  36.         
  37.     exitloop:
  38.         FindClose $2
  39.         Pop $3
  40.         Pop $2
  41.         Pop $1
  42. FunctionEnd
  43.  
  44. !macro SetFileAttributesDirectoryNormal DIRECTORY_TO_SET_NORMAL
  45.   Push `${DIRECTORY_TO_SET_NORMAL}`
  46.   Call SetFileAttributesDirectoryNormal
  47. !macroend
  48.  
  49. !define SetFileAttributesDirectoryNormal '!insertmacro "SetFileAttributesDirectoryNormal"'