BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fileSystem.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: fileSystem.h,v 1.14 2005/07/29 12:38:14 amoll Exp $
5 //
6 
7 #ifndef BALL_SYSTEM_FILESYSTEM_H
8 #define BALL_SYSTEM_FILESYSTEM_H
9 
10 #ifndef BALL_COMMON_H
11 # include <BALL/common.h>
12 #endif
13 
14 #ifdef BALL_HAS_SYS_PARAM_H
15 # include <sys/param.h>
16 #endif
17 
18 // if PATH_MAX is undefined (which sometimes happens on systems
19 // where there is no unambiguous value defined due to severel differing
20 // filesystems), we define it for ourselves to be 1kB
21 #ifndef PATH_MAX
22 # define BALL_PATH_MAX 1023
23 #else
24 # define BALL_PATH_MAX PATH_MAX
25 #endif
26 
27 #ifndef BALL_DATATYPE_STRING_H
28 # include <BALL/DATATYPE/string.h>
29 #endif
30 
31 namespace BALL
32 {
42  {
43  public:
44 
48 
52  static const char PATH_SEPARATOR;
53 
57  static const char* const CURRENT_DIRECTORY;
58 
62  static const char* const PARENT_DIRECTORY;
64 
67  enum
68  {
71  MAX_FILENAME_LENGTH = 256, // NAME_MAX seems to be too restrictive for modern Unixes
74  MAX_PATH_LENGTH = BALL_PATH_MAX
75  };
76 
80 
92  static void canonizePath(String& path);
93 
98  static String baseName(const String& filename);
99 
104  static String path(const String& filename);
106 
107  private:
108 
109  static void expandTilde_(String& path);
110  };
111 
112 } // namespace BALL
113 
114 #endif // BALL_SYSTEM_FILESYSTEM_H