home *** CD-ROM | disk | FTP | other *** search
- /* Copy to System
- **
- ** By : Karol Rybak (biedron@friko.internet.pl)
- **
- **
- ** This is a simple script that copies system files right to their directories.
- ** It's very simple and uninteligent. It just checks file extensions so it won't
- ** work with all the system files. I hope you find it usefull.
- **
- ** USAGE : copy_to_system.rexx FILENAME
- **
- ** FILENAME : filename must be entered in double quotes ("). If you use Scalos
- ** it's unimportant but if you want to use this script in some
- ** filemanager it's important. But you may change script so that
- ** the doubleqoutes won't be required.
- */
-
-
- /* Some variables to change */
-
- classes_dir = "System:classes/"
- datatypes_dir = "System:classes/datatypes/" /* files with .datatype extension go there */
- gadgets_dir = "System:classes/gadgets/"
- images_dir = "System:classes/images/"
- devices_dir = "System:Devs/"
- fonts_dir = "System:Fonts/"
- libs_dir = "System:libs/"
- plugins_dir = "Scalos:plugins/"
- modules_dir = "Scalos:modules/"
- def_dir = "ASK" /* unrecognized files go there (you can enter a directory or "ASK" if you want to be asked for a directory to copy a file to)*/
-
- /* Here we go */
-
- Parse arg name /* Get arguments */
-
- font = FALSE
- destdir = def_dir
- Do
- If Index(name,'.class') ~=0 Then Do ; destdir = classes_dir ;Leave ;End
- If Index(name,'.datatype') ~=0 Then Do ; destdir = datatypes_dir ;Leave ;End
- If Index(name,'.gadget') ~=0 Then Do ; destdir = gadgets_dir ;Leave ;End
- If Index(name,'.image') ~=0 Then Do ; destdir = images_dir ;Leave ;End
- If Index(name,'.device') ~=0 Then Do ; destdir = devices_dir ;Leave ;End
- If Index(name,'.font') ~=0 Then Do ; destdir = fonts_dir ;font=TRUE ;Leave ;End
- If Index(name,'.library') ~=0 Then Do ; destdir = libs_dir ;Leave ;End
- If Index(name,'.plugin') ~=0 Then Do ; destdir = plugins_dir ;Leave ;End
- If Index(name,'.module') ~=0 Then Do ; destdir = modules_dir ;Leave ;End
- End
-
- If destdir = "ASK" Then
- Do
- addlib('rexxreqtools.library',0,-30)
- destdir=RtFileRequest('System:',,'Select Destination Directory',,'rtfi_flags=freqf_nofiles',)
- If destdir="" Then Exit
- End
-
- address command 'copy' name destdir
-
- If font=TRUE Then /* if a file is a font this will execute (It's getting out a bitmap directory name and copies it to your font directory)*/
- Do
- pos=Index(name,'.')
- name=DelStr(name,pos) /* This looks a little strange but its working */
- name=name || '"'
- dir=name
- pos=1
- Do Forever
- pos=Index(dir,"/")
- if pos=0 Then break
- dir=Delstr(dir,1,pos)
- End
- address command 'Copy' name '"' || destdir || dir ">NIL:"
- End
-
-