|
OpenADFortTk (basic)
|
00001 // ########################################################## 00002 // # This file is part of OpenADFortTk. # 00003 // # The full COPYRIGHT notice can be found in the top # 00004 // # level directory of the OpenADFortTk source tree. # 00005 // # For more information visit # 00006 // # http://www.mcs.anl.gov/openad # 00007 // ########################################################## 00008 00009 #ifndef FileUtil_h 00010 #define FileUtil_h 00011 00012 #include <string> 00013 00014 namespace FileUtil { 00015 00016 // FileName: Given a path, returns the filename portion. If path is 00017 // NULL or ends in '/', returns the empty string. 00018 // Examples: 00019 // fname.ext --> fname.ext 00020 // /path/fname.ext --> fname.ext 00021 // /usr/lib --> lib 00022 // /usr/ --> 00023 // / --> 00024 extern std::string 00025 FileName(const char* path); 00026 00027 // BaseName: Given a path, returns the 'basename' portion, the final 00028 // component of the pathname, first deleting any trailing '/'. If path is 00029 // NULL or empty, returns ".". (Note: libgen.h is not available on 00030 // Cygwin!) 00031 // Examples: 00032 // fname.ext --> fname.ext 00033 // /path/fname.ext --> fname.ext 00034 // /usr/lib --> lib 00035 // /usr/ --> usr 00036 // / --> / 00037 extern std::string 00038 BaseName(const char* path); 00039 00040 // DirName: Given a path, returns the 'dirname' portion, the pathanem 00041 // of the parent directory, first deleting any trailing '/'. If path 00042 // is NULL or empty, returns "."; if path does not conain a '/' 00043 // returns ".". ".". (Note: libgen.h is not available on Cygwin!) 00044 // Examples: 00045 // /path/fname.ext --> /path 00046 // /usr/lib --> /usr 00047 // /usr/ --> / 00048 // usr --> . 00049 // / --> / 00050 // . --> . 00051 // .. --> . 00052 extern std::string 00053 DirName(const char* path); 00054 00055 00056 }; 00057 00058 #endif