Common: The Data Directory - make_datadir

Cogent Tools Demo and Tutorials: Version 4.0
Prev | Chapter 12. Controller Functions | Next

# 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);
       }

Prev | Home | Next
Common: The Process Status Display - `show_names`, `toggle_raw`, `.reassign_prog_name`, `extra_space` | Up | Log Functions

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.