BALL  1.4.1
 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 #include <limits.h>
15 #ifdef BALL_HAS_SYS_PARAM_H
16 # include <sys/param.h>
17 #endif
18 
19 // if PATH_MAX is undefined (which sometimes happens on systems
20 // where there is no unambiguous value defined due to severel differing
21 // filesystems), we define it for ourselves to be 1kB
22 #ifndef PATH_MAX
23 # define BALL_PATH_MAX 1023
24 #else
25 # define BALL_PATH_MAX PATH_MAX
26 #endif
27 
28 #ifndef BALL_DATATYPE_STRING_H
29 # include <BALL/DATATYPE/string.h>
30 #endif
31 
32 namespace BALL
33 {
43  {
44  public:
45 
49 
53  static const char PATH_SEPARATOR;
54 
58  static const char* const CURRENT_DIRECTORY;
59 
63  static const char* const PARENT_DIRECTORY;
65 
68  enum
69  {
72  MAX_FILENAME_LENGTH = 256, // NAME_MAX seems to be too restrictive for modern Unixes
75  MAX_PATH_LENGTH = BALL_PATH_MAX
76  };
77 
81 
93  static void canonizePath(String& path);
94 
99  static String baseName(const String& filename);
100 
105  static String path(const String& filename);
107 
108  private:
109 
110  static void expandTilde_(String& path);
111  };
112 
113 } // namespace BALL
114 
115 #endif // BALL_SYSTEM_FILESYSTEM_H