install_released_files.anubis 2.44 KB

   
   Installing the library files for the next realease. 

   This file is not part of the distribution. 
   
   
   
read official_library.anubis

   
define String    
   copy_command 
     = 
   if host_system is 
     {
       beos      then "cp",
       linux     then "cp",
       windows   then "copy"
     }. 
   
define String
   source_dir
     = 
   if host_system is 
     {
       beos      then alert,
       linux     then "/home/alp/anubis_dev/library/",
       windows   then ".\\"
     }

   
define String 
   dest_dir 
     =
   if host_system is 
     {
       beos      then alert,
       linux     then "/home/alp/anubis_distrib/library/",
       windows   then "C:\\Anubis_dev\\anubis_distrib\\library\\"
     }.
   
   
define Bool
   is_mask    // test if a file path is a file mask (contains a '*')
     (
       String path,
       Int  i
     ) =
   if nth(i,path) is 
     {
       failure then false,
       success(c) then 
         if c = '*'
         then true
         else is_mask(path,i+1)
     }.
   
   
define Bool
   file_exists     // check is a file exists
     (
       String path           
     ) =
   if is_mask(path,0) then alert else   // 'path' must not be a mask
   if file(path,read) is 
     {
       failure     then false, 
       success(_)  then true
     }. 
   
   
   
define One 
   copy_one_file    // copy a single file
     (
       String file_path     // relative to 'library/'
     ) =
   if is_mask(file_path,0) then alert else       // must not be a mask
     //
     // Check if the file exists
     //
     (if file_exists(source_dir + file_path)
      then unique 
      else print("File '"+file_path+"' does not exist.\n")); 
     //
     // Copy the file
     //
     if execute(copy_command,
                [
                  source_dir + file_path,
                  dest_dir   + file_path
                ]) is 
       {
         failure    then print("Cannot copy file '"+file_path+"'.\n"),
         success(n) then 
           if n = 0
           then unique
           else print("Problem while copying file '"+file_path+"'.\n")
       }. 
  
    


define One
   do_for_one_path
     (
       String path
     ) =
   if is_mask(path,0) 
   then (if split_path(path) is (path_part,mask_part) then 
         map_forget(copy_one_file,directory_list(source_dir+path_part,mask_part)))
   else copy_one_file(path). 
   
      
global define One
   install_released_files
     (
       List(String) args
     ) =