Functions

ut_path.h File Reference

#include <glib.h>
#include <time.h>
#include <limits.h>
#include "ut_types.h"
#include "ut_string_class.h"
#include "ut_go_file.h"
#include "ut_rand.h"

Go to the source code of this file.

Functions

ABI_EXPORT const char * UT_basename (const char *path)
ABI_EXPORT UT_UTF8String UT_go_basename (const char *uri)
ABI_EXPORT std::string UT_createTmpFile (const std::string &prefix, const std::string &extension)
ABI_EXPORT bool UT_directoryExists (const char *dir)
ABI_EXPORT bool UT_isRegularFile (const char *filename)
ABI_EXPORT size_t UT_fileSize (const char *filename)
ABI_EXPORT time_t UT_mTime (const char *path)
ABI_EXPORT bool UT_legalizeFileName (std::string &filename)

Function Documentation

ABI_EXPORT 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().

ABI_EXPORT std::string UT_createTmpFile ( const std::string &  prefix,
const std::string &  extension 
)
ABI_EXPORT bool UT_directoryExists ( const char *  dir  ) 

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

References MAX_PATH.

Referenced by XAP_AppImpl::localizeHelpUrl().

ABI_EXPORT size_t UT_fileSize ( const char *  filename  ) 

References UT_ASSERT, and UT_SHOULD_NOT_HAPPEN.

ABI_EXPORT UT_UTF8String UT_go_basename ( const char *  uri  ) 
ABI_EXPORT bool UT_isRegularFile ( const char *  filename  ) 
ABI_EXPORT 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().

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

ABI_EXPORT 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.