FAUST compiler  0.9.9.6b8
Functions | Variables
files.cpp File Reference
#include "files.hh"
#include "compatibility.hh"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
Include dependency graph for files.cpp:

Go to the source code of this file.

Functions

int cholddir ()
 Switch back to the previously stored current directory. More...
 
int mkchdir (string dirname)
 Create a new directory in the current one to store the diagrams. More...
 
int makedir (string dirname)
 
void getCurrentDir ()
 

Variables

static string gCurrentDir
 Room to save current directory name. More...
 

Function Documentation

int cholddir ( )

Switch back to the previously stored current directory.

Definition at line 40 of file files.cpp.

References gCurrentDir.

41 {
42  if (chdir(gCurrentDir.c_str()) == 0) {
43  return 0;
44  } else {
45  perror("cholddir");
46  exit(errno);
47  }
48 }
static string gCurrentDir
Room to save current directory name.
Definition: files.cpp:34
void getCurrentDir ( )

Definition at line 87 of file files.cpp.

References FAUST_PATH_MAX, and gCurrentDir.

88 {
89  char buffer[FAUST_PATH_MAX];
90  gCurrentDir = getcwd(buffer, FAUST_PATH_MAX);
91 }
static string gCurrentDir
Room to save current directory name.
Definition: files.cpp:34
#define FAUST_PATH_MAX
int makedir ( string  dirname)

Definition at line 72 of file files.cpp.

References FAUST_PATH_MAX, and gCurrentDir.

Referenced by copyFaustSources(), and printDoc().

73 {
74  char buffer[FAUST_PATH_MAX];
75  gCurrentDir = getcwd(buffer, FAUST_PATH_MAX);
76 
77  if (gCurrentDir.c_str() != 0) {
78  int status = mkdir(dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
79  if (status == 0 || errno == EEXIST) {
80  return 0;
81  }
82  }
83  perror("makedir");
84  exit(errno);
85 }
static string gCurrentDir
Room to save current directory name.
Definition: files.cpp:34
#define FAUST_PATH_MAX

Here is the caller graph for this function:

int mkchdir ( string  dirname)

Create a new directory in the current one to store the diagrams.

The current directory is saved to be later restored.

Definition at line 55 of file files.cpp.

References FAUST_PATH_MAX, and gCurrentDir.

Referenced by drawSchema(), and printDoc().

56 {
57  char buffer[FAUST_PATH_MAX];
58  gCurrentDir = getcwd(buffer, FAUST_PATH_MAX);
59 
60  if (gCurrentDir.c_str() != 0) {
61  int status = mkdir(dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
62  if (status == 0 || errno == EEXIST) {
63  if (chdir(dirname.c_str()) == 0) {
64  return 0;
65  }
66  }
67  }
68  perror("mkchdir");
69  exit(errno);
70 }
static string gCurrentDir
Room to save current directory name.
Definition: files.cpp:34
#define FAUST_PATH_MAX

Here is the caller graph for this function:

Variable Documentation

string gCurrentDir
static

Room to save current directory name.

Definition at line 34 of file files.cpp.

Referenced by cholddir(), getCurrentDir(), makedir(), and mkchdir().