author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 22 Aug 2011 11:53:10 +0100 | |
branch | jv |
changeset 17851 | 09d75924b034 |
parent 17846 | 24edc476ac18 |
child 17859 | cc167a69671c |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
172 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5556 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
1 | 14 |
Collection subclass:#FileDirectory |
1290 | 15 |
instanceVariableNames:'pathName lazy' |
16 |
classVariableNames:'PathOfCurrentDirectory' |
|
17 |
poolDictionaries:'' |
|
3203
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
18 |
category:'Obsolete' |
1 | 19 |
! |
20 |
||
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
21 |
ArrayedCollection subclass:#DirectoryEntry |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
22 |
instanceVariableNames:'name creationTime modificationTime dirFlag fileSize' |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
23 |
classVariableNames:'' |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
24 |
poolDictionaries:'' |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
25 |
privateIn:FileDirectory |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
26 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
27 |
|
88 | 28 |
!FileDirectory class methodsFor:'documentation'! |
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
172 | 33 |
All Rights Reserved |
1 | 34 |
|
88 | 35 |
This software is furnished under a license and may be used |
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
1 | 43 |
|
88 | 44 |
documentation |
45 |
" |
|
3203
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
46 |
Notice: |
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
47 |
This class is obsolete and does work only under UNIX. |
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
48 |
Use Filename instead. |
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
49 |
|
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
50 |
This class is not available in other ST-systems; |
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
51 |
in contrast, ST-80 provides a Filename class. |
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
52 |
Therefore, Filename has taken over the functionality. |
09a9b6bde8af
Moved into category 'Obsolete'.
Stefan Vogel <sv@exept.de>
parents:
3201
diff
changeset
|
53 |
|
88 | 54 |
FileDirectories represent directories in the underlying host system. |
55 |
They provide various methods to create/delete and query for files and/or |
|
202 | 56 |
directories. Also, since FileDirectory inherits from Collection, it |
57 |
provides all enumeration and testing protocol. For example, you can |
|
58 |
loop over the filenames in a directory using 'aFileDirectory do:[:nm | ...]'. |
|
59 |
||
1290 | 60 |
[author:] |
61 |
Claus Gittinger |
|
62 |
||
63 |
[see also:] |
|
64 |
Filename |
|
65 |
FileStream DirectoryStream OperatingSystem |
|
88 | 66 |
" |
67 |
! ! |
|
1 | 68 |
|
2 | 69 |
!FileDirectory class methodsFor:'initialization'! |
70 |
||
71 |
initialize |
|
276 | 72 |
"/ |
73 |
"/ want to know about image restart |
|
74 |
"/ |
|
2 | 75 |
ObjectMemory addDependent:self |
76 |
! |
|
77 |
||
1469 | 78 |
update:something with:aParameter from:changedObject |
276 | 79 |
"/ |
80 |
"/ currentDirectory may be different when restarted |
|
81 |
"/ |
|
3941
574defdaaa40
flush cached current-dir-path earlier.
Claus Gittinger <cg@exept.de>
parents:
3203
diff
changeset
|
82 |
something == #earlySystemInstallation ifTrue:[ |
1469 | 83 |
PathOfCurrentDirectory := nil |
2 | 84 |
] |
1469 | 85 |
|
3941
574defdaaa40
flush cached current-dir-path earlier.
Claus Gittinger <cg@exept.de>
parents:
3203
diff
changeset
|
86 |
"Created: / 15.6.1996 / 15:20:21 / cg" |
574defdaaa40
flush cached current-dir-path earlier.
Claus Gittinger <cg@exept.de>
parents:
3203
diff
changeset
|
87 |
"Modified: / 11.12.1998 / 16:28:40 / cg" |
2 | 88 |
! ! |
89 |
||
1 | 90 |
!FileDirectory class methodsFor:'instance creation'! |
91 |
||
92 |
currentDirectory |
|
93 |
"create and return a new FileDirectory for the current directory" |
|
94 |
||
2951 | 95 |
"/ self obsoleteMethodWarning:'use Filename'. |
17851 | 96 |
^ self on:(Filename currentDirectory name) |
88 | 97 |
|
98 |
" |
|
99 |
FileDirectory currentDirectory contents |
|
100 |
FileDirectory currentDirectory files |
|
101 |
FileDirectory currentDirectory isReadable |
|
102 |
FileDirectory currentDirectory pathName |
|
103 |
" |
|
17851 | 104 |
|
105 |
"Modified: / 20-08-2011 / 12:19:51 / cg" |
|
1 | 106 |
! |
107 |
||
605 | 108 |
directoryNamed:name |
109 |
"create and return a new FileDirectory for the directory |
|
110 |
with given pathname" |
|
111 |
||
2951 | 112 |
"/ self obsoleteMethodWarning:'use Filename'. |
2921 | 113 |
name asString = '.' ifTrue:[ |
17851 | 114 |
Filename currentDirectory name ~= '.' ifTrue:[ |
115 |
^ self currentDirectory |
|
116 |
] |
|
2921 | 117 |
]. |
17851 | 118 |
^ self on:(name asFilename constructString:'') |
605 | 119 |
|
120 |
" |
|
121 |
(FileDirectory directoryNamed:'..') pathName |
|
122 |
(FileDirectory directoryNamed:'../..') files |
|
123 |
" |
|
17851 | 124 |
|
125 |
"Modified: / 20-08-2011 / 12:19:57 / cg" |
|
605 | 126 |
! |
127 |
||
1 | 128 |
directoryNamed:name in:aFileDirectory |
129 |
"create and return a new FileDirectory for the directory with given name |
|
130 |
in another FileDirectory" |
|
131 |
||
2961 | 132 |
|baseName| |
1 | 133 |
|
2951 | 134 |
"/ self obsoleteMethodWarning:'use Filename'. |
2921 | 135 |
|
136 |
name asFilename isAbsolute ifTrue:[ |
|
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
137 |
^ self directoryNamed:name |
1 | 138 |
]. |
2921 | 139 |
|
1 | 140 |
(aFileDirectory isKindOf:FileDirectory) ifTrue:[ |
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
141 |
baseName := aFileDirectory pathName |
1 | 142 |
] ifFalse:[ |
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
143 |
baseName := aFileDirectory |
1 | 144 |
]. |
17851 | 145 |
^ self on:((Filename named:baseName) constructString:name) |
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
146 |
|
17851 | 147 |
"Modified: / 28-04-1997 / 22:34:47 / dq" |
148 |
"Modified: / 20-08-2011 / 12:20:03 / cg" |
|
149 |
! |
|
150 |
||
151 |
on:aDirectoryPathName |
|
152 |
^ (self basicNew) pathName:aDirectoryPathName |
|
153 |
||
154 |
"Created: / 20-08-2011 / 12:19:28 / cg" |
|
605 | 155 |
! |
156 |
||
157 |
rootDirectory |
|
158 |
"create and return a new FileDirectory for the root directory" |
|
159 |
||
2951 | 160 |
"/ self obsoleteMethodWarning:'use Filename'. |
17851 | 161 |
^ self on:(Filename rootDirectory name) |
605 | 162 |
|
163 |
" |
|
164 |
FileDirectory rootDirectory contents |
|
165 |
FileDirectory rootDirectory files |
|
166 |
FileDirectory rootDirectory isReadable |
|
167 |
" |
|
17851 | 168 |
|
169 |
"Modified: / 20-08-2011 / 12:20:09 / cg" |
|
276 | 170 |
! ! |
171 |
||
7305 | 172 |
!FileDirectory class methodsFor:'Compatibility-Squeak'! |
5729 | 173 |
|
7655 | 174 |
default |
175 |
^ (self basicNew) pathName:(Filename defaultDirectory name) |
|
176 |
! |
|
177 |
||
5777 | 178 |
localNameFor:aFileNameString |
179 |
^ aFileNameString asFilename baseName |
|
180 |
! |
|
181 |
||
5729 | 182 |
pathNameDelimiter |
183 |
^ Filename separator |
|
17851 | 184 |
! |
185 |
||
186 |
slash |
|
187 |
^ Filename separator asString |
|
188 |
||
189 |
"Created: / 20-08-2011 / 12:18:27 / cg" |
|
5729 | 190 |
! ! |
191 |
||
276 | 192 |
!FileDirectory class methodsFor:'private'! |
193 |
||
194 |
fullPathNameOf:name in:path |
|
195 |
|sep| |
|
196 |
||
197 |
sep := OperatingSystem fileSeparator asString. |
|
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
198 |
|
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
199 |
"/ is it an absolute path ? |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
200 |
|
276 | 201 |
(name startsWith:sep) ifTrue:[ |
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
202 |
^ name |
276 | 203 |
]. |
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
204 |
|
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
205 |
"/ temporary kludge; this and the previous should |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
206 |
"/ go into OS isAbsolutePath .. |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
207 |
|
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
208 |
OperatingSystem isMSDOSlike ifTrue:[ |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
209 |
('[a-zA-Z]:*' match:name) ifTrue:[ |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
210 |
"/ drive spec ... |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
211 |
^ name |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
212 |
] |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
213 |
]. |
276 | 214 |
^ path , sep , name |
2590
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
215 |
|
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
216 |
"Modified: 28.4.1997 / 22:06:17 / cg" |
6855cfa1e628
temporary kludge for drive specifiers in MSDOS fileNames.
Claus Gittinger <cg@exept.de>
parents:
1469
diff
changeset
|
217 |
"Modified: 28.4.1997 / 22:34:18 / dq" |
1 | 218 |
! ! |
219 |
||
7655 | 220 |
!FileDirectory methodsFor:'Compatibility-Squeak'! |
221 |
||
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
222 |
assureExistence |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
223 |
self asFilename recursiveMakeDirectory |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
224 |
! |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
225 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
226 |
containingDirectory |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
227 |
^ self class |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
228 |
directoryNamed:(self asFilename directory pathName) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
229 |
! |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
230 |
|
7655 | 231 |
deleteDirectory:dirName |
9332 | 232 |
"Squeak/ST80 compatibility" |
7655 | 233 |
|
234 |
^ self removeDirectory:dirName |
|
235 |
! |
|
236 |
||
237 |
deleteFileNamed:fileName |
|
9332 | 238 |
"Squeak/ST80 compatibility" |
7655 | 239 |
|
240 |
^ self removeFile:fileName |
|
241 |
! |
|
242 |
||
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
243 |
directoryEntryFor:name |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
244 |
|info| |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
245 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
246 |
info := self infoOf:name. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
247 |
^ DirectoryEntry new |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
248 |
name:name |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
249 |
creationTime:(info creationTime) |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
250 |
modificationTime:(info modificationTime) |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
251 |
dirFlag:(info isDirectory) |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
252 |
fileSize:(info isDirectory) |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
253 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
254 |
" |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
255 |
(FileDirectory directoryNamed:'.') entries |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
256 |
" |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
257 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
258 |
|
9332 | 259 |
directoryExists:dir |
260 |
"Squeak/ST80 compatibility" |
|
261 |
||
262 |
|f| |
|
263 |
||
264 |
f := self filenameFor:dir. |
|
265 |
^ f exists and:[f isDirectory ]. |
|
266 |
! |
|
267 |
||
7655 | 268 |
directoryNames |
9332 | 269 |
"Squeak/ST80 compatibility" |
7655 | 270 |
|
271 |
^ self directories |
|
272 |
! |
|
273 |
||
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
274 |
entries |
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
275 |
^ self contents collect:[:nm | self directoryEntryFor:nm]. |
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
276 |
! |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
277 |
|
9334 | 278 |
fileExists:dir |
279 |
"Squeak/ST80 compatibility" |
|
280 |
||
281 |
|f| |
|
282 |
||
283 |
f := self filenameFor:dir. |
|
284 |
^ f exists and:[f isDirectory not ]. |
|
285 |
! |
|
286 |
||
7655 | 287 |
fileNames |
9332 | 288 |
"Squeak/ST80 compatibility" |
7655 | 289 |
|
290 |
^ self files |
|
291 |
! |
|
292 |
||
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
293 |
forceNewFileNamed:fn |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
294 |
"Squeak/ST80 compatibility" |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
295 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
296 |
|f| |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
297 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
298 |
f := self filenameFor:fn. |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
299 |
^ f writeStream |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
300 |
! |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
301 |
|
7655 | 302 |
includesKey:name |
9332 | 303 |
"Squeak/ST80 compatibility" |
7655 | 304 |
|
305 |
^ self exists:name |
|
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
306 |
! |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
307 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
308 |
readOnlyFileNamed:fn |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
309 |
"Squeak/ST80 compatibility" |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
310 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
311 |
|f| |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
312 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
313 |
f := self filenameFor:fn. |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
314 |
^ f readStream |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
315 |
! |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
316 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
317 |
recursiveDelete |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
318 |
self asFilename recursiveRemove |
7655 | 319 |
! ! |
7305 | 320 |
|
1 | 321 |
!FileDirectory methodsFor:'accessing'! |
322 |
||
323 |
baseName |
|
324 |
"return my baseName |
|
325 |
- thats the directory name without leading parent-dirs" |
|
326 |
||
327 |
lazy ifTrue:[self getFullPathName]. |
|
2921 | 328 |
^ pathName asFilename baseName |
1 | 329 |
! |
330 |
||
331 |
contents |
|
2708
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
332 |
"return a collection with all files and subdirectories in the receiver. |
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
333 |
Skips any '.' or '..' entries (UNIX)" |
1 | 334 |
|
335 |
|coll| |
|
336 |
||
337 |
coll := OrderedCollection new. |
|
338 |
self do:[:name | |
|
2708
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
339 |
name ~= '.' ifTrue:[ |
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
340 |
name ~= '..' ifTrue:[ |
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
341 |
coll add:name |
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
342 |
] |
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
343 |
] |
1 | 344 |
]. |
276 | 345 |
coll sort. |
1 | 346 |
^ coll |
2708
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
347 |
|
6c4a4f30d540
skip '.' and '..' in #contents
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
348 |
"Modified: 20.6.1997 / 17:05:43 / cg" |
1 | 349 |
! |
350 |
||
351 |
directories |
|
352 |
"return a collection with all subdirectories in the receiver directory" |
|
353 |
||
354 |
|coll| |
|
355 |
||
356 |
coll := OrderedCollection new. |
|
357 |
self directoriesDo:[:name | |
|
172 | 358 |
coll add:name |
1 | 359 |
]. |
276 | 360 |
coll sort. |
1 | 361 |
^ coll |
362 |
! |
|
363 |
||
605 | 364 |
directoryName |
365 |
"return my directoryName |
|
366 |
- thats the directory name where I'm in" |
|
367 |
||
368 |
lazy ifTrue:[self getFullPathName]. |
|
2921 | 369 |
^ pathName asFilename directoryName |
605 | 370 |
! |
371 |
||
1 | 372 |
files |
373 |
"return a collection with all plain files in the receiver directory" |
|
374 |
||
375 |
|coll| |
|
376 |
||
377 |
coll := OrderedCollection new. |
|
378 |
self filesDo:[:name | |
|
172 | 379 |
coll add:name |
1 | 380 |
]. |
276 | 381 |
coll sort. |
382 |
^ coll |
|
605 | 383 |
! |
384 |
||
385 |
pathName |
|
386 |
"return my full pathname" |
|
387 |
||
388 |
lazy ifTrue:[self getFullPathName]. |
|
389 |
^ pathName |
|
390 |
! |
|
391 |
||
392 |
pathName:dirName |
|
393 |
"set my pathname; return nil if not a valid path; self otherwise" |
|
394 |
||
395 |
pathName := dirName. |
|
396 |
(dirName startsWith:OperatingSystem fileSeparator) ifFalse:[ |
|
397 |
lazy := true |
|
398 |
] ifTrue:[ |
|
399 |
(dirName startsWith:'./') ifFalse:[ |
|
400 |
"/ (dirName includes:$.) ifTrue:[ |
|
401 |
lazy := true |
|
402 |
] |
|
403 |
]. |
|
404 |
^ self |
|
405 |
! ! |
|
406 |
||
407 |
!FileDirectory methodsFor:'basic'! |
|
408 |
||
409 |
createDirectory:newName |
|
410 |
"create a new filedirectory as a subdirectory of myself; |
|
411 |
return true if successful" |
|
412 |
||
413 |
|realName| |
|
414 |
||
415 |
(newName notNil and:[newName notEmpty]) ifTrue:[ |
|
416 |
(newName ~= '.' and:[newName ~= '..']) ifTrue:[ |
|
417 |
((newName at:1) == OperatingSystem fileSeparator) ifTrue:[ |
|
418 |
realName := newName copyFrom:2 |
|
419 |
] ifFalse:[ |
|
420 |
realName := newName |
|
421 |
]. |
|
2921 | 422 |
^ (self filenameFor:realName) makeDirectory |
605 | 423 |
] |
424 |
]. |
|
425 |
^ false |
|
426 |
! |
|
427 |
||
428 |
link:oldFileName to:newFileName |
|
429 |
"link oldFileName to newFileName in myself, return true if successful" |
|
430 |
||
431 |
|path1 path2| |
|
432 |
||
433 |
path1 := self pathNameOf:oldFileName. |
|
434 |
path2 := self pathNameOf:newFileName. |
|
435 |
^ OperatingSystem linkFile:path1 to:path2 |
|
436 |
! |
|
437 |
||
438 |
remove:aFileOrDirectoryName |
|
439 |
"remove the file or directory from myself; return true if successful" |
|
440 |
||
2921 | 441 |
^ (self filenameFor:aFileOrDirectoryName) remove |
605 | 442 |
! |
443 |
||
444 |
removeDirectory:dirName |
|
445 |
"remove the directory 'dirName' from myself; return true if successful. |
|
446 |
If the directory is not empty, the containing files/directories are also |
|
447 |
removed." |
|
448 |
||
2921 | 449 |
^ (self filenameFor:dirName) recursiveRemove |
605 | 450 |
! |
451 |
||
452 |
removeFile:fileName |
|
453 |
"remove the file 'fileName' from myself; return true if successful" |
|
454 |
||
2921 | 455 |
^ (self filenameFor:fileName) remove |
605 | 456 |
! |
457 |
||
458 |
renameFile:oldFileName newName:newFileName |
|
459 |
"rename the file; return true if successful" |
|
460 |
||
2921 | 461 |
|f1 f2| |
605 | 462 |
|
2921 | 463 |
f1 := self filenameFor:oldFileName. |
464 |
f2 := self filenameFor:newFileName. |
|
465 |
^ f1 renameTo:f2 |
|
1 | 466 |
! ! |
467 |
||
172 | 468 |
!FileDirectory methodsFor:'converting'! |
469 |
||
470 |
asFilename |
|
471 |
"return myself as a filename" |
|
472 |
||
473 |
^ self pathName asFilename |
|
474 |
! |
|
475 |
||
476 |
asFilename:someFile |
|
477 |
"return a filename for a file named someFile in myself" |
|
478 |
||
276 | 479 |
^ self asFilename construct:someFile |
172 | 480 |
! ! |
481 |
||
605 | 482 |
!FileDirectory methodsFor:'enumerating'! |
483 |
||
484 |
allDirectoriesDo:aBlock |
|
485 |
"evaluate the argument, aBlock for every directory name |
|
486 |
in the directory and in all subdirectories" |
|
487 |
||
488 |
|aStream command line| |
|
489 |
||
490 |
lazy ifTrue:[self getFullPathName]. |
|
491 |
command := 'cd ' , pathName , '; find . -type d -print'. |
|
492 |
aStream := PipeStream readingFrom:command. |
|
493 |
aStream isNil ifTrue:[^ nil]. |
|
494 |
[aStream atEnd] whileFalse:[ |
|
495 |
line := aStream nextLine. |
|
496 |
line notNil ifTrue:[ |
|
497 |
(line = '.') ifFalse:[ |
|
498 |
"cut off initial ./" |
|
499 |
line := line copyFrom:3 |
|
500 |
]. |
|
501 |
aBlock value:line |
|
502 |
] |
|
503 |
]. |
|
504 |
aStream close |
|
505 |
! |
|
506 |
||
507 |
allFilesDo:aBlock |
|
508 |
"evaluate the argument, aBlock for every file name in the directory and in all |
|
509 |
subdirectories" |
|
510 |
||
511 |
|aStream command line| |
|
512 |
||
513 |
lazy ifTrue:[self getFullPathName]. |
|
514 |
command := 'cd ' , pathName , '; find . -print'. |
|
515 |
aStream := PipeStream readingFrom:command. |
|
516 |
aStream isNil ifTrue:[^ nil]. |
|
517 |
[aStream atEnd] whileFalse:[ |
|
518 |
line := aStream nextLine. |
|
519 |
line notNil ifTrue:[ |
|
520 |
(line = '.') ifFalse:[ |
|
521 |
"cut off initial ./" |
|
522 |
line := line copyFrom:3 |
|
523 |
]. |
|
524 |
aBlock value:line |
|
525 |
] |
|
526 |
]. |
|
527 |
aStream close |
|
528 |
! |
|
529 |
||
530 |
directoriesDo:aBlock |
|
531 |
"evaluate the argument, aBlock for every subdirectory name in the directory" |
|
532 |
||
533 |
self where:[:name | (self isDirectory:name) ifTrue:[ |
|
534 |
((name ~= '.') and:[name ~= '..']) |
|
535 |
] ifFalse:[ |
|
536 |
false |
|
537 |
] |
|
538 |
] do:aBlock |
|
539 |
! |
|
540 |
||
541 |
do:aBlock |
|
542 |
"evaluate the argument, aBlock for every name in the directory" |
|
543 |
||
544 |
self where:[:name | true] do:aBlock |
|
545 |
! |
|
546 |
||
547 |
filesDo:aBlock |
|
548 |
"evaluate the argument, aBlock for every plain file name in the directory" |
|
549 |
||
550 |
self where:[:name | (self isDirectory:name) not] do:aBlock |
|
551 |
! |
|
552 |
||
553 |
namesDo:aBlock |
|
554 |
"evaluate the argument, aBlock for every name in the directory. |
|
555 |
for ST-80 compatibility" |
|
556 |
||
557 |
self do:aBlock |
|
558 |
! |
|
559 |
||
560 |
where:testBlock do:aBlock |
|
561 |
"evaluate the argument, aBlock for every object in the directory |
|
562 |
for which testBlock evaluates to true." |
|
563 |
||
564 |
|aStream name| |
|
565 |
||
7655 | 566 |
ExternalStream openErrorSignal catch:[ |
567 |
aStream := DirectoryStream directoryNamed:pathName. |
|
568 |
]. |
|
605 | 569 |
aStream isNil ifTrue:[^ nil]. |
570 |
[aStream atEnd] whileFalse:[ |
|
7655 | 571 |
name := aStream nextLine. |
572 |
name notNil ifTrue:[ |
|
573 |
(testBlock value:name) ifTrue:[ |
|
574 |
aBlock value:name |
|
575 |
] |
|
576 |
] |
|
605 | 577 |
]. |
578 |
aStream close |
|
579 |
! ! |
|
580 |
||
581 |
!FileDirectory methodsFor:'more instance creation'! |
|
582 |
||
583 |
directoryNamed:aName |
|
2961 | 584 |
"create & return a new fileDirectory for a subdirectory in myself" |
585 |
||
605 | 586 |
^ self class directoryNamed:aName in:self pathName |
587 |
! ! |
|
588 |
||
589 |
!FileDirectory methodsFor:'printing & storing'! |
|
590 |
||
591 |
printOn:aStream |
|
4392 | 592 |
"append a user printed representation of the receiver to aStream. |
593 |
The format is suitable for a human - not meant to be read back." |
|
605 | 594 |
|
595 |
lazy ifTrue:[self getFullPathName]. |
|
596 |
aStream nextPutAll:'(a FileDirectory pathName:'; |
|
4392 | 597 |
nextPutAll:pathName; |
598 |
nextPutAll:')' |
|
605 | 599 |
! |
600 |
||
601 |
storeOn:aStream |
|
602 |
"append a printed representation of the receiver to aStream, |
|
603 |
which allows reconstructing it via readFrom:" |
|
604 |
||
605 |
lazy ifTrue:[self getFullPathName]. |
|
606 |
aStream nextPutAll:'(FileDirectory directoryNamed:'. |
|
607 |
aStream nextPutAll:pathName. |
|
608 |
aStream nextPut:$) |
|
609 |
! ! |
|
610 |
||
1 | 611 |
!FileDirectory methodsFor:'private'! |
612 |
||
3201
4e72e420fdc3
Documentation: FileDirectory is obsolete and works only under Unix.
Stefan Vogel <sv@exept.de>
parents:
2961
diff
changeset
|
613 |
filenameFor:fileName |
6972
0a2f38d186d5
filenameFor: same algorithm found in Filename
Claus Gittinger <cg@exept.de>
parents:
6550
diff
changeset
|
614 |
"return a filename representing the argument, fileName |
0a2f38d186d5
filenameFor: same algorithm found in Filename
Claus Gittinger <cg@exept.de>
parents:
6550
diff
changeset
|
615 |
either in myself (if the arg is a releative path) or absolute otherwise." |
3201
4e72e420fdc3
Documentation: FileDirectory is obsolete and works only under Unix.
Stefan Vogel <sv@exept.de>
parents:
2961
diff
changeset
|
616 |
|
6972
0a2f38d186d5
filenameFor: same algorithm found in Filename
Claus Gittinger <cg@exept.de>
parents:
6550
diff
changeset
|
617 |
^ pathName asFilename filenameFor:fileName |
3201
4e72e420fdc3
Documentation: FileDirectory is obsolete and works only under Unix.
Stefan Vogel <sv@exept.de>
parents:
2961
diff
changeset
|
618 |
! |
4e72e420fdc3
Documentation: FileDirectory is obsolete and works only under Unix.
Stefan Vogel <sv@exept.de>
parents:
2961
diff
changeset
|
619 |
|
9334 | 620 |
fullNameFor:fileName |
621 |
"return a filename representing the argument, fileName |
|
622 |
either in myself (if the arg is a releative path) or absolute otherwise." |
|
623 |
||
624 |
^ (pathName asFilename filenameFor:fileName) asAbsoluteFilename |
|
625 |
! |
|
626 |
||
1 | 627 |
getFullPathName |
628 |
"make my pathname be a full pathname - i.e. starting at root" |
|
629 |
||
308 | 630 |
|shortPathName| |
1 | 631 |
|
2921 | 632 |
|
159 | 633 |
(pathName = OperatingSystem fileSeparator asString) ifTrue:[ |
172 | 634 |
lazy := false. |
635 |
^ self |
|
1 | 636 |
]. |
637 |
||
638 |
"since currentDirectory is used very often, cache its path here" |
|
639 |
||
640 |
(pathName = '.') ifTrue:[ |
|
172 | 641 |
PathOfCurrentDirectory notNil ifTrue:[ |
642 |
pathName := PathOfCurrentDirectory. |
|
643 |
lazy := false. |
|
644 |
^ self |
|
645 |
] |
|
1 | 646 |
]. |
647 |
||
648 |
shortPathName := pathName. |
|
649 |
||
308 | 650 |
pathName := OperatingSystem pathNameOf:pathName. |
651 |
lazy := false. |
|
1 | 652 |
|
308 | 653 |
" |
654 |
if it was the current dir, keep name for next query |
|
655 |
" |
|
1 | 656 |
(shortPathName = '.') ifTrue:[ |
308 | 657 |
PathOfCurrentDirectory := pathName |
1 | 658 |
] |
276 | 659 |
! |
660 |
||
661 |
pathNameOf:fileName |
|
2961 | 662 |
"return the pathname for an entry in myself" |
663 |
||
2921 | 664 |
^ (pathName asFilename construct:fileName) osName |
1 | 665 |
! ! |
666 |
||
605 | 667 |
!FileDirectory methodsFor:'queries'! |
1 | 668 |
|
605 | 669 |
accessModeOf:name |
670 |
"return the access-mode bits (rwxrwxrwx) of a file in myself" |
|
1 | 671 |
|
605 | 672 |
^ OperatingSystem accessModeOf:(self pathNameOf:name) |
1 | 673 |
! |
674 |
||
605 | 675 |
changeAccessModeOf:name to:modeBits |
676 |
"set the access-mode bits (rwxrwxrwx) of a file in myself" |
|
1 | 677 |
|
605 | 678 |
^ OperatingSystem changeAccessModeOf:(self pathNameOf:name) to:modeBits |
1 | 679 |
! |
680 |
||
681 |
exists |
|
682 |
"return true if this directory exists" |
|
683 |
||
2921 | 684 |
^ (Filename named:pathName) isDirectory |
159 | 685 |
|
686 |
" |
|
687 |
(FileDirectory directoryNamed:'fooBar') exists |
|
688 |
(FileDirectory directoryNamed:'/tmp') exists |
|
689 |
" |
|
1 | 690 |
! |
691 |
||
605 | 692 |
exists:name |
693 |
"return true, if the given name exists in myself" |
|
694 |
||
2921 | 695 |
^ (self filenameFor:name) exists |
605 | 696 |
! |
697 |
||
698 |
id |
|
699 |
"return the directories file-id (inode number)" |
|
700 |
||
2921 | 701 |
^ (Filename named:pathName) id |
605 | 702 |
! |
703 |
||
704 |
infoOf:name |
|
705 |
"return an array filled with file info for the file 'aFileName'; |
|
706 |
return nil if such a file does not exist" |
|
707 |
||
2921 | 708 |
^ (self filenameFor:name) info |
605 | 709 |
! |
710 |
||
711 |
isDirectory:name |
|
712 |
"return true, if the given name is that of a directory in myself" |
|
713 |
||
2921 | 714 |
^ (self filenameFor:name) isDirectory |
605 | 715 |
! |
716 |
||
717 |
isExecutable:name |
|
718 |
"return true, if the given file is executable" |
|
1 | 719 |
|
2921 | 720 |
^ (self filenameFor:name) isExecutable |
1 | 721 |
! |
722 |
||
723 |
isReadable:name |
|
724 |
"return true, if the given file is readable" |
|
725 |
||
2921 | 726 |
^ (self filenameFor:name) isReadable |
1 | 727 |
! |
728 |
||
729 |
isWritable:name |
|
730 |
"return true, if the given file is readable" |
|
731 |
||
2921 | 732 |
^ (self filenameFor:name) isWritable |
1 | 733 |
! |
734 |
||
605 | 735 |
species |
6550 | 736 |
"return the type of collection to be returned by collect, select etc." |
737 |
||
605 | 738 |
^ OrderedCollection |
1 | 739 |
! |
740 |
||
605 | 741 |
timeOfLastChange |
742 |
"return the timeStamp of myself" |
|
1 | 743 |
|
2921 | 744 |
^ (Filename named:pathName) modificationTime |
1 | 745 |
! |
746 |
||
605 | 747 |
timeOfLastChange:name |
748 |
"return the timeStamp of a file in myself" |
|
1 | 749 |
|
2921 | 750 |
^ (self filenameFor:name) modificationTime |
1 | 751 |
! |
752 |
||
605 | 753 |
typeOf:name |
754 |
"return the symbolic type of a file in myself" |
|
1 | 755 |
|
2921 | 756 |
^ (self filenameFor:name) type |
605 | 757 |
! ! |
1 | 758 |
|
5556 | 759 |
!FileDirectory methodsFor:'testing'! |
760 |
||
761 |
isEmpty |
|
762 |
"return true, if the directory is empty; |
|
763 |
redefined since '.' and '..' do not count as entries here." |
|
764 |
||
765 |
self do:[:fName | |
|
766 |
((fName ~= '.') and:[fName ~= '..']) ifTrue:[^ false]. |
|
767 |
]. |
|
768 |
^ true |
|
769 |
! ! |
|
770 |
||
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
771 |
!FileDirectory::DirectoryEntry methodsFor:'accessing'! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
772 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
773 |
at: index |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
774 |
"compatibility interface" |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
775 |
"self halt: 'old-style access to DirectoryEntry'" |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
776 |
index = 1 ifTrue: [ ^self name ]. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
777 |
index = 2 ifTrue: [ ^self creationTime ]. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
778 |
index = 3 ifTrue: [ ^self modificationTime ]. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
779 |
index = 4 ifTrue:[ ^self isDirectory ]. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
780 |
index = 5 ifTrue:[ ^self fileSize ]. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
781 |
self error: 'invalid index specified'. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
782 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
783 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
784 |
creationTime |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
785 |
^ creationTime |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
786 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
787 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
788 |
dirFlag |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
789 |
^ dirFlag |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
790 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
791 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
792 |
fileSize |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
793 |
^ fileSize |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
794 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
795 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
796 |
modificationTime |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
797 |
^ modificationTime |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
798 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
799 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
800 |
name |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
801 |
^ name |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
802 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
803 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
804 |
name:nameArg creationTime:creationTimeArg modificationTime:modificationTimeArg dirFlag:dirFlagArg fileSize:fileSizeArg |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
805 |
name := nameArg. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
806 |
creationTime := creationTimeArg. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
807 |
modificationTime := modificationTimeArg. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
808 |
dirFlag := dirFlagArg. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
809 |
fileSize := fileSizeArg. |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
810 |
! ! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
811 |
|
629 | 812 |
!FileDirectory class methodsFor:'documentation'! |
813 |
||
814 |
version |
|
17851 | 815 |
^ '$Id: FileDirectory.st 10675 2011-08-22 10:53:10Z vranyj1 $' |
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
816 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
817 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
818 |
version_CVS |
17851 | 819 |
^ '§Header: /cvs/stx/stx/libbasic/FileDirectory.st,v 1.50 2011/08/21 16:01:15 cg Exp §' |
629 | 820 |
! ! |
6972
0a2f38d186d5
filenameFor: same algorithm found in Filename
Claus Gittinger <cg@exept.de>
parents:
6550
diff
changeset
|
821 |
|
17846 | 822 |
FileDirectory initialize! |
17851 | 823 |