Functions

ut_path.cpp File Reference

#include "ut_path.h"
#include "ut_assert.h"
#include "ut_debugmsg.h"
#include "ut_string_class.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <windows.h>

Functions

const char * UT_basename (const char *path)
bool UT_directoryExists (const char *dir)
bool UT_isRegularFile (const char *filename)
size_t UT_fileSize (const char *filename)
time_t UT_mTime (const char *path)
bool UT_legalizeFileName (std::string &filename)

Function Documentation

const char* UT_basename ( const char *  path  ) 

This function takes a char* representing a path to a file and returns the pointer to the string which represents the base portion of the path.

For example, if path = "/home/foo/bar.ext", then this function returns a char* pointing to "bar.ext".

bool UT_directoryExists ( const char *  dir  ) 

if dir is an existing directory, this function returns true, otherwise, it returns false

References MAX_PATH.

size_t UT_fileSize ( const char *  filename  ) 

References UT_ASSERT, and UT_SHOULD_NOT_HAPPEN.

bool UT_isRegularFile ( const char *  filename  ) 

References MAX_PATH, and UT_DEBUGMSG.

bool UT_legalizeFileName ( std::string &  filename  ) 

check that the given filename is legal and remove any illegal characters

Parameters:
filename [in/out] the suggested file name
Returns:
false if filename is left unchanged, true otherwise

References UT_UTF8Stringbuf::UTF8Iterator::advance(), UT_UTF8Stringbuf::charCode(), UT_UTF8Stringbuf::UTF8Iterator::current(), FREEP, UT_UTF8String::getIterator(), UT_UTF8Stringbuf::UTF8Iterator::start(), and UT_UTF8String::utf8_str().

time_t UT_mTime ( const char *  path  ) 

If the directory/file 'path' exist its mtime (modification time) is returned

References UT_ASSERT, UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.