12.7. Common: The Data Directory - make_datadir

This function uses Gamma's mkdir function to make a temporary directory for all the data files generated by the Log and History programs. It uses Gamma's is_dir function to ensure that the /tmp directory is on the system.

   /*--------------------------------------------------------------------
    * Function:    make_datadir
    * Returns:     t or nil
    * Description: Creates a temporary directory to hold data from the Log
    *              and History programs.  Called when the Controller is
    *              created in program_startup().
    *------------------------------------------------------------------*/
   function make_datadir()
   {
     if (!is_dir("/tmp"))
       mkdir("/tmp", 0o777);
     system("rm -fr /tmp/cogentdemo/");
     mkdir("/tmp/cogentdemo", 0o777);
   }