1 /*******************************************************************************
2 
3         copyright:      Copyright (c) 2005 Kris Bell. All rights reserved
4 
5         license:        BSD style: $(LICENSE)
6 
7         version:        Initial release: March 2005
8 
9         author:         Kris
10 
11 *******************************************************************************/
12 
13 module tango.io.model.IFile;
14 
15 /*******************************************************************************
16 
17         Generic file-oriented attributes.
18 
19 *******************************************************************************/
20 
21 interface FileConst
22 {
23         /***********************************************************************
24 
25                 A set of file-system specific constants for file and path
26                 separators (chars and strings).
27 
28                 Keep these constants mirrored for each OS.
29 
30         ***********************************************************************/
31 
32         version (Win32)
33         {
34                 ///
35                 enum : char
36                 {
37                         /// The current directory character.
38                         CurrentDirChar = '.',
39 
40                         /// The file separator character.
41                         FileSeparatorChar = '.',
42 
43                         /// The path separator character.
44                         PathSeparatorChar = '/',
45 
46                         /// The system path character.
47                         SystemPathChar = ';',
48                 }
49 
50                 /// The parent directory string
51                 __gshared immutable immutable(char)[] ParentDirString = "..";
52 
53                 /// The current directory string
54                 __gshared immutable immutable(char)[] CurrentDirString = ".";
55 
56                 /// The file separator string
57                 __gshared immutable immutable(char)[] FileSeparatorString = ".";
58 
59                 /// The path separator string
60                 __gshared immutable immutable(char)[] PathSeparatorString = "/";
61 
62                 /// The system path string
63                 __gshared immutable immutable(char)[] SystemPathString = ";";
64 
65                 /// The newline string
66                 __gshared immutable immutable(char)[] NewlineString = "\r\n";
67         }
68 
69         version (Posix)
70         {
71                 ///
72                 enum : char
73                 {
74                         /// The current directory character.
75                         CurrentDirChar = '.',
76 
77                         /// The file separator character.
78                         FileSeparatorChar = '.',
79 
80                         /// The path separator character.
81                         PathSeparatorChar = '/',
82 
83                         /// The system path character.
84                         SystemPathChar = ':',
85                 }
86 
87                 /// The parent directory string
88                 __gshared immutable immutable(char)[] ParentDirString = "..";
89 
90                 /// The current directory string
91                 __gshared immutable immutable(char)[] CurrentDirString = ".";
92 
93                 /// The file separator string
94                 __gshared immutable immutable(char)[] FileSeparatorString = ".";
95 
96                 /// The path separator string
97                 __gshared immutable immutable(char)[] PathSeparatorString = "/";
98 
99                 /// The system path string
100                 __gshared immutable immutable(char)[] SystemPathString = ":";
101 
102                 /// The newline string
103                 __gshared immutable immutable(char)[] NewlineString = "\n";
104         }
105 }
106 
107 /*******************************************************************************
108 
109         Passed around during file-scanning.
110 
111 *******************************************************************************/
112 
113 struct FileInfo
114 {
115         const(char)[]   path,
116                         name;
117         ulong           bytes;
118         bool            folder,
119                         hidden,
120                         system;
121 }
122