BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: fileSystem.h,v 1.14 2005/07/29 12:38:14 amoll Exp $ 00005 // 00006 00007 #ifndef BALL_SYSTEM_FILESYSTEM_H 00008 #define BALL_SYSTEM_FILESYSTEM_H 00009 00010 #ifndef BALL_COMMON_H 00011 # include <BALL/common.h> 00012 #endif 00013 00014 #include <limits.h> 00015 #ifdef BALL_HAS_SYS_PARAM_H 00016 # include <sys/param.h> 00017 #endif 00018 00019 // if PATH_MAX is undefined (which sometimes happens on systems 00020 // where there is no unambiguous value defined due to severel differing 00021 // filesystems), we define it for ourselves to be 1kB 00022 #ifndef PATH_MAX 00023 # define BALL_PATH_MAX 1023 00024 #else 00025 # define BALL_PATH_MAX PATH_MAX 00026 #endif 00027 00028 #ifndef BALL_DATATYPE_STRING_H 00029 # include <BALL/DATATYPE/string.h> 00030 #endif 00031 00032 namespace BALL 00033 { 00042 class BALL_EXPORT FileSystem 00043 { 00044 public: 00045 00049 00053 static const char PATH_SEPARATOR; 00054 00058 static const char* const CURRENT_DIRECTORY; 00059 00063 static const char* const PARENT_DIRECTORY; 00065 00068 enum 00069 { 00072 MAX_FILENAME_LENGTH = 256, // NAME_MAX seems to be too restrictive for modern Unixes 00075 MAX_PATH_LENGTH = BALL_PATH_MAX 00076 }; 00077 00081 00093 static void canonizePath(String& path); 00094 00099 static String baseName(const String& filename); 00100 00105 static String path(const String& filename); 00107 00108 private: 00109 00110 static void expandTilde_(String& path); 00111 }; 00112 00113 } // namespace BALL 00114 00115 #endif // BALL_SYSTEM_FILESYSTEM_H