home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Update local index files $VER: UpdateIndices 1.1 (8.11.2000) by Neil Bothwick 1.1 - Uses "parse source" to get the name of the CD */ /* ;;; Initialise */ options results address command signal on error call LoadLib('rexxsupport.library') call LoadLib('rexxdossupport.library') parse source . ' ' . ' ' . ' ' ScriptName ' ' . CDName = left(ScriptName, pos(':', ScriptName) - 1) ;;; /* ;;; Ask whether the user wishes to update */ if pos('AUTUP=Automatic',GetVar('AACD.prefs',Global,Binary)) = 0 then do if length(GetVar('AACDIndex')||GetVar('AminetCDIndex')||GetVar('AminetSetIndex')||GetVar('AminetIndex')) = 0 then exit 'RequestChoice >ENV:AAUpdateNow "Amiga Active CD" "Do you wish to update the CD index*Nfiles on your hard drive with the new*Nones from the CD?" "Yes|No"' if GetVar('AAUpdateNow') = 0 then do call ShowMsg('This requester should not appear again.*NYou may update the index files at any time*Nfrom the Search section of AACDprefs') call delete('ENV:AAUpdateNow') exit end call delete('ENV:AAUpdateNow') end ;;; /* ;;; Update Index files */ /* AACD indices */ DestDir = GetVar('AACDIndex') SrcDir = CDName':CDTools/Indices' Pattern = ParsePattern('AACD??',NOCASE) if DestDir > '' then call CopyFiles() /* Aminet CD indices */ DestDir = GetVar('AminetCDIndex') SrcDir = CDName':AACD/Resources/CDROM/Aminet/CDs' Pattern = ParsePattern('Index??',NOCASE) if DestDir > '' then call CopyFiles() /* Aminet Set indices */ DestDir = GetVar('AminetSetIndex') SrcDir = CDName':AACD/Resources/CDROM/Aminet/Sets' Pattern = ParsePattern('Set?',NOCASE) if DestDir > '' then call CopyFiles() /* Aminet Online indices */ DestDir = GetVar('AminetIndex') if DestDir > '' then do SrcDir = CDName':AACD/Resources/Online/Aminet' call DateCopy('INDEX') call DateCopy('dirlist') call open(List,AddPart(SrcDir,'dirlist'),'R') do until eof(List) File = readln(List) if File = '' then iterate call DateCopy(File) end call close(List) end ;;; /* ;;; Exit */ if Updated = 1 then call ShowMsg('All index files are up to date') exit ;;; /* ;;; Copy new files */ CopyFiles: FileList = showdir(SrcDir) do i = 1 to words(FileList) if MatchPattern(Pattern,word(FileList,i),NOCASE,PARSED) then call DateCopy(word(FileList,i)) end return ;;; /* ;;; Copy updated files */ DateCopy: parse arg FileName if word(statef(AddPart(SrcDir,FileName)),5) > word(statef(AddPart(DestDir,FileName)),5) then do address command 'Copy >NIL:' AddPart(SrcDir,FileName) DestDir 'CLONE' Updated = 1 end return ;;; /* ;;; Load a library */ LoadLib: parse arg library if show('L',library) then return if ~exists('LIBS:'library) then address command 'copy System/Libs/'library 'LIBS: clone quiet' if ~addlib(library,0,-30,0) then call ExitMsg('Failed to load' library||'0a'x||'Make sure you have run InitCD') return ;;; /* ;;; ShowMsg */ ShowMsg: parse arg msg address command 'RequestChoice >NIL: "Amiga Active CD" "'msg'" "OK"' return ;;; /* ;;; Error handler */ Error: call ShowMsg('Error' RC 'in line' sigl) if RC > 5 then exit return ;;;