00001 // -*-Mode: C++;-*- 00002 // $Header: /Volumes/cvsrep/developer/OpenADFortTk/src/lib/support/FileUtil.h,v 1.1 2004/06/01 22:25:42 eraxxon Exp $ 00003 00004 // * BeginRiceCopyright ***************************************************** 00005 // ******************************************************* EndRiceCopyright * 00006 00007 //*************************************************************************** 00008 // 00009 // File: 00010 // $Source: /Volumes/cvsrep/developer/OpenADFortTk/src/lib/support/FileUtil.h,v $ 00011 // 00012 // Purpose: 00013 // [The purpose of this file] 00014 // 00015 // Description: 00016 // [The set of functions, macros, etc. defined in the file] 00017 // 00018 //*************************************************************************** 00019 00020 #ifndef FileUtil_h 00021 #define FileUtil_h 00022 00023 //************************* System Include Files **************************** 00024 00025 #include <string> 00026 00027 //*************************** User Include Files **************************** 00028 00029 //*************************** Forward Declarations *************************** 00030 00031 //**************************************************************************** 00032 00033 namespace FileUtil { 00034 00035 // FileName: Given a path, returns the filename portion. If path is 00036 // NULL or ends in '/', returns the empty string. 00037 // Examples: 00038 // fname.ext --> fname.ext 00039 // /path/fname.ext --> fname.ext 00040 // /usr/lib --> lib 00041 // /usr/ --> 00042 // / --> 00043 extern std::string 00044 FileName(const char* path); 00045 00046 // BaseName: Given a path, returns the 'basename' portion, the final 00047 // component of the pathname, first deleting any trailing '/'. If path is 00048 // NULL or empty, returns ".". (Note: libgen.h is not available on 00049 // Cygwin!) 00050 // Examples: 00051 // fname.ext --> fname.ext 00052 // /path/fname.ext --> fname.ext 00053 // /usr/lib --> lib 00054 // /usr/ --> usr 00055 // / --> / 00056 extern std::string 00057 BaseName(const char* path); 00058 00059 // DirName: Given a path, returns the 'dirname' portion, the pathanem 00060 // of the parent directory, first deleting any trailing '/'. If path 00061 // is NULL or empty, returns "."; if path does not conain a '/' 00062 // returns ".". ".". (Note: libgen.h is not available on Cygwin!) 00063 // Examples: 00064 // /path/fname.ext --> /path 00065 // /usr/lib --> /usr 00066 // /usr/ --> / 00067 // usr --> . 00068 // / --> / 00069 // . --> . 00070 // .. --> . 00071 extern std::string 00072 DirName(const char* path); 00073 00074 00075 }; /* namespace FileUtil */ 00076 00077 #endif
1.5.7.1