Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4FileUtilities Class Reference

#include <G4FileUtilities.hh>

Public Member Functions

 G4FileUtilities ()
 
 ~G4FileUtilities ()
 
G4bool FileExists (const std::string file)
 
std::string StrErrNo () const
 
G4int Shell (std::string str)
 
G4int CopyFile (const std::string srcFile, const std::string dstFile)
 
G4int DeleteFile (const std::string file, const std::string option)
 
std::string GetEnv (const std::string env)
 

Detailed Description

Definition at line 49 of file G4FileUtilities.hh.

Constructor & Destructor Documentation

G4FileUtilities::G4FileUtilities ( )

Definition at line 36 of file G4FileUtilities.cc.

37 {
38 }
G4FileUtilities::~G4FileUtilities ( )

Definition at line 41 of file G4FileUtilities.cc.

42 {
43 }

Member Function Documentation

G4int G4FileUtilities::CopyFile ( const std::string  srcFile,
const std::string  dstFile 
)

Definition at line 61 of file G4FileUtilities.cc.

62 {
63  std::string cmd = "cp " + srcFile + " " + dstFile;
64  return Shell( cmd );
65 }
G4int Shell(std::string str)

Here is the call graph for this function:

G4int G4FileUtilities::DeleteFile ( const std::string  file,
const std::string  option 
)

Definition at line 68 of file G4FileUtilities.cc.

69 {
70  std::string cmd = "rm " + option + " " + file;
71  return Shell( cmd );
72 }
G4int Shell(std::string str)

Here is the call graph for this function:

G4bool G4FileUtilities::FileExists ( const std::string  file)

Definition at line 46 of file G4FileUtilities.cc.

47 {
48  char* c = (char *) file.c_str();
49 
50  G4int fd = ::open( c, O_RDONLY );
51  // G4int error = errno;
52  if ( fd != -1 ) {
53  ::close( fd );
54  return true;
55  } else {
56  return false;
57  }
58 }
int G4int
Definition: G4Types.hh:78
tuple c
Definition: test.py:13

Here is the caller graph for this function:

std::string G4FileUtilities::GetEnv ( const std::string  env)
inline

Definition at line 74 of file G4FileUtilities.hh.

74 { return ::getenv(env.c_str()); };
G4int G4FileUtilities::Shell ( std::string  str)
inline

Definition at line 65 of file G4FileUtilities.hh.

65 { return ::system(str.c_str()); };

Here is the caller graph for this function:

std::string G4FileUtilities::StrErrNo ( ) const
inline

Definition at line 62 of file G4FileUtilities.hh.

62 { return ::strerror(errno); };

The documentation for this class was generated from the following files: