UT_FileUtil Class Reference

#include <UT_FileUtil.h>

List of all members.

Public Member Functions

 UT_FileUtil ()
virtual ~UT_FileUtil ()
int removeOverrideFiles (const char *newbasepath, const char *relpath, const char *fname, const char *english, int flags, const char *stripinfo=0)
virtual void showError (const char *error, int severity=2)
virtual int showPrompt (const char *prompt)

Static Public Member Functions

static int64 getFileSize (const char *path)
static int resolveSymbolicLinks (const char *path, UT_WorkBuffer &contents, bool allow_dangling_link=false)
static int copyFile (const char *srcname, const char *dstname)
static int copyFileToStream (const char *srcname, ostream &os)
static int moveFile (const char *srcname, const char *dstname)
static int removeFile (const char *fname)
static bool makeDir (const char *path, mode_t mode=0777, bool ignore_umask=false)
static bool makeDirs (const char *path, mode_t mode=0777, bool ignore_umask=false)
static bool lockFile (int fd)
static bool unlockFile (int fd)
static void upDirectory (char *path, int levels)
static int removeLinesFromFile (const char *fname, const char *prefix, int readonly=0)
static bool readXMLElementFromFile (const char *xml_file_path, const char *element_name, UT_String &element_data)


Detailed Description

Definition at line 44 of file UT_FileUtil.h.


Constructor & Destructor Documentation

UT_FileUtil::UT_FileUtil (  )  [inline]

Definition at line 47 of file UT_FileUtil.h.

virtual UT_FileUtil::~UT_FileUtil (  )  [inline, virtual]

Definition at line 48 of file UT_FileUtil.h.


Member Function Documentation

static int UT_FileUtil::copyFile ( const char *  srcname,
const char *  dstname 
) [static]

static int UT_FileUtil::copyFileToStream ( const char *  srcname,
ostream &  os 
) [static]

static int64 UT_FileUtil::getFileSize ( const char *  path  )  [static]

Returns the file size of that file in the given path. Returns -1 on error.

static bool UT_FileUtil::lockFile ( int  fd  )  [static]

Locks a file for exclusive access. Will not return until the file lock is achiveved or an error occurs. Note: On Linux, if any file descriptor referring to this file is closed, the lock will be automatically be closed. Be very careful! Returns true if the file lock succeeded, and false otherwise.

static bool UT_FileUtil::makeDir ( const char *  path,
mode_t  mode = 0777,
bool  ignore_umask = false 
) [static]

Make a single directory. All leading path components must exist. The function returns true if the path already exists or if the path was made.

Parameters:
path 
The path to create
mode 
The unix file mode
ignore_mask 
By default, the users umask will be used in conjunction with the mode. This parameter will force the mode to be the given value.

static bool UT_FileUtil::makeDirs ( const char *  path,
mode_t  mode = 0777,
bool  ignore_umask = false 
) [static]

Make a directory and all the parent directories needed

Parameters:
path 
The path to create
mode 
The unix file mode
ignore_mask 
By default, the users umask will be used in conjunction with the mode. This parameter will force the mode to be the given value.

static int UT_FileUtil::moveFile ( const char *  srcname,
const char *  dstname 
) [static]

static bool UT_FileUtil::readXMLElementFromFile ( const char *  xml_file_path,
const char *  element_name,
UT_String element_data 
) [static]

Parses the file in search of the given XML element and outputs its contents into the string argument. Returns true uppon success or false on failure.

static int UT_FileUtil::removeFile ( const char *  fname  )  [static]

static int UT_FileUtil::removeLinesFromFile ( const char *  fname,
const char *  prefix,
int  readonly = 0 
) [static]

int UT_FileUtil::removeOverrideFiles ( const char *  newbasepath,
const char *  relpath,
const char *  fname,
const char *  english,
int  flags,
const char *  stripinfo = 0 
)

static int UT_FileUtil::resolveSymbolicLinks ( const char *  path,
UT_WorkBuffer contents,
bool  allow_dangling_link = false 
) [static]

Follow the specified symbolic link to the contents, recursing if the contents are themselves another symbolic link. This method will fail if the specified path is not to a symbolic link, or if the link does not point to an existing file when allow_dangling_link is false.

virtual void UT_FileUtil::showError ( const char *  error,
int  severity = 2 
) [virtual]

virtual int UT_FileUtil::showPrompt ( const char *  prompt  )  [virtual]

static bool UT_FileUtil::unlockFile ( int  fd  )  [static]

Unlocks a file that was locked for exclusive access with lockFile, above. Returns true if the unlock succeeded, and false otherwise.

static void UT_FileUtil::upDirectory ( char *  path,
int  levels 
) [static]


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

Generated on Fri May 25 00:10:46 2012 for HDK by  doxygen 1.5.9