Functions

ut_path.cpp File Reference

#include "ut_path.h"
#include "ut_string_class.h"
#include "ut_assert.h"
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.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".

Referenced by AP_UnixDialog_New::_constructWindow(), IE_Imp_RTF::_loadFile(), IE_Exp_PalmDoc::_writeDocument(), IE_Exp_HTML::_writeDocument(), IE_Exp_S5::_writeHeader(), Defun_EV_GetMenuItemComputedLabel_Fn(), XAP_UnixDialog_FileOpenSaveAs::fileTypeChanged(), XAP_CocoaModule::load(), XAP_ModuleManager::loadModule(), and strippath().

bool UT_directoryExists ( const char *  dir  ) 

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

Referenced by XAP_AppImpl::localizeHelpUrl().

size_t UT_fileSize ( const char *  filename  ) 
bool UT_isRegularFile ( const char *  filename  ) 
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

Referenced by UT_runDialog_AskForPathname::run(), and s_AskForPathname().

time_t UT_mTime ( const char *  path  ) 

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