author | Claus Gittinger <cg@exept.de> |
Wed, 14 Jan 2004 13:56:39 +0100 | |
changeset 7826 | c32044219031 |
parent 6268 | e4bf390583ac |
child 7955 | f3a24f9588ee |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
155 | 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 |
" |
|
12 |
||
7826 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
1 | 15 |
FileStream subclass:#DirectoryStream |
1664 | 16 |
instanceVariableNames:'dirPointer readAheadEntry' |
1281
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
17 |
classVariableNames:'' |
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
18 |
poolDictionaries:'' |
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
19 |
category:'Streams-External' |
1 | 20 |
! |
21 |
||
217 | 22 |
!DirectoryStream primitiveDefinitions! |
1 | 23 |
%{ |
437 | 24 |
|
1631 | 25 |
#define UNIX_LIKE |
2609 | 26 |
|
1631 | 27 |
#if defined(WIN32) |
28 |
# undef UNIX_LIKE |
|
29 |
#endif |
|
437 | 30 |
|
2896 | 31 |
#if defined(transputer) |
32 |
# undef UNIX_LIKE |
|
33 |
#endif |
|
34 |
||
1631 | 35 |
#ifdef UNIX_LIKE |
36 |
# include <stdio.h> |
|
37 |
# define _STDIO_H_INCLUDED_ |
|
38 |
||
39 |
# include <errno.h> |
|
40 |
# define _ERRNO_H_INCLUDED_ |
|
10 | 41 |
|
2896 | 42 |
# include <sys/types.h> |
43 |
# include <sys/stat.h> |
|
1631 | 44 |
|
2896 | 45 |
# ifdef HAS_OPENDIR |
46 |
# include <sys/types.h> |
|
47 |
# ifdef NEXT |
|
48 |
# include <sys/dir.h> |
|
49 |
# else |
|
50 |
# include <dirent.h> |
|
1 | 51 |
# endif |
52 |
# endif |
|
223 | 53 |
|
54 |
/* |
|
55 |
* on some systems errno is a macro ... check for it here |
|
56 |
*/ |
|
1631 | 57 |
# ifndef errno |
58 |
extern errno; |
|
59 |
# endif |
|
2896 | 60 |
|
1631 | 61 |
#endif /* UNIX_LIKE */ |
62 |
||
2896 | 63 |
|
1631 | 64 |
#ifdef WIN32 |
65 |
||
66 |
# ifdef i386 |
|
67 |
# define _X86_ |
|
68 |
# endif |
|
69 |
||
70 |
# undef INT |
|
71 |
# undef Array |
|
72 |
# undef Number |
|
73 |
# undef Method |
|
74 |
# undef Point |
|
75 |
# undef Context |
|
76 |
# undef Rectangle |
|
1989 | 77 |
# undef Block |
4298 | 78 |
# undef Time |
79 |
# undef Date |
|
1631 | 80 |
|
2685 | 81 |
/* # include <types.h> /* */ |
1989 | 82 |
# include <stdarg.h> /* */ |
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
83 |
# include <errno.h> |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
84 |
# define _ERRNO_H_INCLUDED_ |
1989 | 85 |
# include <windef.h> /* */ |
86 |
# include <winbase.h> /* */ |
|
4298 | 87 |
/* # include <wingdi.h> /* */ |
88 |
/* # include <winuser.h> /* */ |
|
1631 | 89 |
|
90 |
# ifdef __DEF_Array |
|
91 |
# define Array __DEF_Array |
|
92 |
# endif |
|
93 |
# ifdef __DEF_Number |
|
94 |
# define Number __DEF_Number |
|
95 |
# endif |
|
96 |
# ifdef __DEF_Method |
|
97 |
# define Method __DEF_Method |
|
98 |
# endif |
|
99 |
# ifdef __DEF_Point |
|
100 |
# define Point __DEF_Point |
|
101 |
# endif |
|
1989 | 102 |
# ifdef __DEF_Block |
103 |
# define Block __DEF_Block |
|
104 |
# endif |
|
1631 | 105 |
# ifdef __DEF_Context |
106 |
# define Context __DEF_Context |
|
107 |
# endif |
|
4298 | 108 |
# ifdef __DEF_Date |
109 |
# define Date __DEF_Date |
|
110 |
# endif |
|
111 |
# ifdef __DEF_Time |
|
112 |
# define Time __DEF_Time |
|
113 |
# endif |
|
1631 | 114 |
|
2999
b0e55440cf12
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
2982
diff
changeset
|
115 |
# define __HANDLEVal(o) (HANDLE)__externalAddressVal(o) |
1631 | 116 |
|
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
117 |
# ifndef DO_WRAP_CALLS |
6266
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
118 |
# define STX_C_CALL0(__nm__, __f__) __f__((__a1__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
119 |
# define STX_C_CALL1(__nm__, __f__, __a1__) __f__((__a1__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
120 |
# define STX_C_CALL2(__nm__, __f__, __a1__, __a2__) __f__((__a1__), (__a2__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
121 |
# define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __f__((__a1__), (__a2__), (__a3__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
122 |
# define STX_API_CALL0(__nm__, __f__) __f__((__a1__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
123 |
# define STX_API_CALL1(__nm__, __f__, __a1__) __f__((__a1__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
124 |
# define STX_API_CALL2(__nm__, __f__, __a1__, __a2__) __f__((__a1__), (__a2__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
125 |
# define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __f__((__a1__), (__a2__), (__a3__)) |
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
126 |
# else |
6266
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
127 |
# define STX_C_CALL0(__nm__, __f__) __STX_C_CALL0(__nm__,(void*)__f__) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
128 |
# define STX_C_CALL1(__nm__, __f__, __a1__) __STX_C_CALL1(__nm__,(void*)__f__, (void*)(__a1__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
129 |
# define STX_C_CALL2(__nm__, __f__, __a1__, __a2__) __STX_C_CALL2(__nm__,(void*)__f__, (void*)(__a1__), (void*)(__a2__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
130 |
# define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __STX_C_CALL3(__nm__,(void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
131 |
# define STX_API_CALL0(__nm__, __f__) __STX_API_CALL0(__nm__,(void*)__f__) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
132 |
# define STX_API_CALL1(__nm__, __f__, __a1__) __STX_API_CALL1(__nm__,(void*)__f__, (void*)(__a1__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
133 |
# define STX_API_CALL2(__nm__, __f__, __a1__, __a2__) __STX_API_CALL2(__nm__,(void*)__f__, (void*)(__a1__), (void*)(__a2__)) |
b12e2e6a84d7
pass name of called API/C function in wrap
Claus Gittinger <cg@exept.de>
parents:
6259
diff
changeset
|
134 |
# define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __STX_API_CALL3(__nm__,(void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__)) |
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
135 |
# endif |
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
136 |
|
1631 | 137 |
#endif /* WIN32 */ |
223 | 138 |
|
1 | 139 |
%} |
206 | 140 |
! ! |
1 | 141 |
|
438 | 142 |
!DirectoryStream primitiveFunctions! |
143 |
%{ |
|
2896 | 144 |
|
145 |
#ifndef HAS_OPENDIR |
|
146 |
# if defined(__VMS__) |
|
147 |
||
3816
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
148 |
# define lib$find_file LIB$FIND_FILE |
438 | 149 |
|
150 |
/* |
|
151 |
** VMS readdir() routines. |
|
152 |
** Written by Rich $alz, <rsalz@bbn.com> in August, 1990. |
|
153 |
** This code has no copyright. |
|
154 |
*/ |
|
155 |
||
156 |
/* 12-NOV-1990 added d_namlen field and special case "." name -GJC@MITECH.COM |
|
157 |
*/ |
|
158 |
||
2896 | 159 |
# ifndef _STDIO_H_INCLUDED_ |
160 |
# include <stdio.h> |
|
161 |
# define _STDIO_H_INCLUDED_ |
|
162 |
# endif |
|
438 | 163 |
|
2896 | 164 |
# ifndef _CTYPE_H_INCLUDED_ |
165 |
# include <ctype.h> |
|
166 |
# define _CTYPE_H_INCLUDED_ |
|
167 |
# endif |
|
438 | 168 |
|
2896 | 169 |
# ifndef _ERRNO_H_INCLUDED_ |
170 |
# include <errno.h> |
|
171 |
# define _ERRNO_H_INCLUDED_ |
|
172 |
# endif |
|
438 | 173 |
|
2896 | 174 |
# ifndef _DESCRIP_H_INCLUDED_ |
175 |
# include <descrip.h> |
|
176 |
# define _DESCRIP_H_INCLUDED_ |
|
177 |
# endif |
|
438 | 178 |
|
2896 | 179 |
# ifndef _RMSDEF_H_INCLUDED_ |
180 |
# include <rmsdef.h> |
|
181 |
# define _RMSDEF_H_INCLUDED_ |
|
182 |
# endif |
|
438 | 183 |
|
184 |
/* |
|
185 |
* actually, the following has to go into dirent.h ... |
|
186 |
*/ |
|
2896 | 187 |
/* BEGIN included dirent.h |
438 | 188 |
* |
189 |
** Header file for VMS readdir() routines. |
|
190 |
** Written by Rich $alz, <rsalz@bbn.com> in August, 1990. |
|
191 |
** This code has no copyright. |
|
192 |
** |
|
193 |
** You must #include <descrip.h> before this file. |
|
194 |
*/ |
|
195 |
||
196 |
/* 12-NOV-1990 added d_namlen field -GJC@MITECH.COM */ |
|
197 |
||
198 |
/* Data structure returned by READDIR(). */ |
|
199 |
struct dirent { |
|
200 |
char d_name[100]; /* File name */ |
|
201 |
int d_namlen; |
|
2957 | 202 |
int vms_verscount; /* Number of versions */ |
203 |
int vms_versions[20]; /* Version numbers */ |
|
438 | 204 |
}; |
205 |
||
206 |
/* Handle returned by opendir(), used by the other routines. You |
|
207 |
* are not supposed to care what's inside this structure. */ |
|
208 |
typedef struct _dirdesc { |
|
209 |
long context; |
|
2957 | 210 |
int vms_wantversions; |
438 | 211 |
char *pattern; |
212 |
struct dirent entry; |
|
213 |
struct dsc$descriptor_s pat; |
|
214 |
} DIR; |
|
215 |
||
216 |
||
217 |
#define rewinddir(dirp) seekdir((dirp), 0L) |
|
218 |
||
219 |
||
220 |
extern DIR *opendir(); |
|
221 |
extern struct dirent *readdir(); |
|
222 |
extern long telldir(); |
|
223 |
extern void seekdir(); |
|
224 |
extern void closedir(); |
|
225 |
extern void vmsreaddirversions(); |
|
226 |
/* |
|
227 |
* END dirent.h |
|
228 |
*/ |
|
2896 | 229 |
#define _DIRENT_H_INCLUDED_ |
438 | 230 |
|
231 |
||
232 |
/* Number of elements in vms_versions array */ |
|
233 |
#define VERSIZE(e) (sizeof e->vms_versions / sizeof e->vms_versions[0]) |
|
234 |
||
235 |
/* Linked in later. */ |
|
236 |
extern char *strrchr(); |
|
237 |
extern char *strcpy(); |
|
238 |
/* Don't need this when all these programs are lumped together. RLD |
|
239 |
extern char *malloc(); |
|
240 |
*/ |
|
241 |
||
242 |
/* |
|
243 |
** Open a directory, return a handle for later use. |
|
244 |
*/ |
|
245 |
DIR * |
|
246 |
opendir(name) |
|
247 |
char *name; |
|
248 |
{ |
|
249 |
DIR *dd; |
|
250 |
||
251 |
/* Get memory for the handle, and the pattern. */ |
|
252 |
if ((dd = (DIR *)malloc(sizeof *dd)) == NULL) { |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
253 |
__threadErrno = ENOMEM; |
438 | 254 |
return NULL; |
255 |
} |
|
256 |
||
257 |
if (strcmp(".",name) == 0) name = ""; |
|
258 |
||
259 |
dd->pattern = malloc((unsigned int)(strlen(name) + sizeof "*.*" + 1)); |
|
260 |
if (dd->pattern == NULL) { |
|
261 |
free((char *)dd); |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
262 |
__threadErrno = ENOMEM; |
438 | 263 |
return NULL; |
264 |
} |
|
265 |
||
266 |
/* Fill in the fields; mainly playing with the descriptor. */ |
|
267 |
(void)sprintf(dd->pattern, "%s*.*", name); |
|
268 |
dd->context = 0; |
|
269 |
dd->vms_wantversions = 0; |
|
270 |
dd->pat.dsc$a_pointer = dd->pattern; |
|
271 |
dd->pat.dsc$w_length = strlen(dd->pattern); |
|
272 |
dd->pat.dsc$b_dtype = DSC$K_DTYPE_T; |
|
273 |
dd->pat.dsc$b_class = DSC$K_CLASS_S; |
|
274 |
||
275 |
return dd; |
|
276 |
} |
|
277 |
||
278 |
/* |
|
279 |
** Set the flag to indicate we want versions or not. |
|
280 |
*/ |
|
281 |
void |
|
282 |
vmsreaddirversions(dd, flag) |
|
283 |
DIR *dd; |
|
284 |
int flag; |
|
285 |
{ |
|
286 |
dd->vms_wantversions = flag; |
|
287 |
} |
|
288 |
||
289 |
/* |
|
290 |
** Free up an opened directory. |
|
291 |
*/ |
|
292 |
void |
|
293 |
closedir(dd) |
|
294 |
DIR *dd; |
|
295 |
{ |
|
296 |
free(dd->pattern); |
|
297 |
free((char *)dd); |
|
298 |
} |
|
299 |
||
300 |
/* |
|
301 |
** Collect all the version numbers for the current file. |
|
302 |
*/ |
|
303 |
static void |
|
304 |
collectversions(dd) |
|
305 |
DIR *dd; |
|
306 |
{ |
|
307 |
struct dsc$descriptor_s pat; |
|
308 |
struct dsc$descriptor_s res; |
|
309 |
struct dirent *e; |
|
310 |
char *p; |
|
311 |
char buff[sizeof dd->entry.d_name]; |
|
312 |
int i; |
|
313 |
char *text; |
|
314 |
long context; |
|
315 |
||
316 |
/* Convenient shorthand. */ |
|
317 |
e = &dd->entry; |
|
318 |
||
319 |
/* Add the version wildcard, ignoring the "*.*" put on before */ |
|
320 |
i = strlen(dd->pattern); |
|
321 |
text = malloc((unsigned int)(i + strlen(e->d_name)+ 2 + 1)); |
|
322 |
if (text == NULL) |
|
323 |
return; |
|
324 |
(void)strcpy(text, dd->pattern); |
|
325 |
(void)sprintf(&text[i - 3], "%s;*", e->d_name); |
|
326 |
||
327 |
/* Set up the pattern descriptor. */ |
|
328 |
pat.dsc$a_pointer = text; |
|
329 |
pat.dsc$w_length = strlen(text); |
|
330 |
pat.dsc$b_dtype = DSC$K_DTYPE_T; |
|
331 |
pat.dsc$b_class = DSC$K_CLASS_S; |
|
332 |
||
333 |
/* Set up result descriptor. */ |
|
334 |
res.dsc$a_pointer = buff; |
|
335 |
res.dsc$w_length = sizeof buff - 2; |
|
336 |
res.dsc$b_dtype = DSC$K_DTYPE_T; |
|
337 |
res.dsc$b_class = DSC$K_CLASS_S; |
|
338 |
||
339 |
/* Read files, collecting versions. */ |
|
340 |
for (context = 0; e->vms_verscount < VERSIZE(e); e->vms_verscount++) { |
|
341 |
if (lib$find_file(&pat, &res, &context) == RMS$_NMF || context == 0) |
|
342 |
break; |
|
343 |
buff[sizeof buff - 1] = '\0'; |
|
344 |
if (p = strchr(buff, ';')) |
|
345 |
e->vms_versions[e->vms_verscount] = atoi(p + 1); |
|
346 |
else |
|
347 |
e->vms_versions[e->vms_verscount] = -1; |
|
348 |
} |
|
349 |
||
350 |
free(text); |
|
351 |
} |
|
352 |
||
353 |
/* |
|
354 |
** Read the next entry from the directory. |
|
355 |
*/ |
|
356 |
struct dirent * |
|
357 |
readdir(dd) |
|
2957 | 358 |
DIR *dd; |
438 | 359 |
{ |
2957 | 360 |
struct dsc$descriptor_s res; |
361 |
char *p; |
|
2982 | 362 |
char buff[sizeof dd->entry.d_name + 10]; |
2957 | 363 |
int i; |
438 | 364 |
|
365 |
/* Set up result descriptor, and get next file. */ |
|
366 |
res.dsc$a_pointer = buff; |
|
367 |
res.dsc$w_length = sizeof buff - 2; |
|
368 |
res.dsc$b_dtype = DSC$K_DTYPE_T; |
|
369 |
res.dsc$b_class = DSC$K_CLASS_S; |
|
370 |
if (lib$find_file(&dd->pat, &res, &dd->context) == RMS$_NMF |
|
371 |
|| dd->context == 0L) |
|
372 |
/* None left... */ |
|
373 |
return NULL; |
|
374 |
||
375 |
/* Force the buffer to end with a NUL. */ |
|
376 |
buff[sizeof buff - 1] = '\0'; |
|
377 |
for (p = buff; !isspace(*p); p++) |
|
378 |
; |
|
379 |
*p = '\0'; |
|
380 |
||
381 |
/* Skip any directory component and just copy the name. */ |
|
382 |
if (p = strchr(buff, ']')) |
|
383 |
(void)strcpy(dd->entry.d_name, p + 1); |
|
384 |
else |
|
385 |
(void)strcpy(dd->entry.d_name, buff); |
|
386 |
||
387 |
/* Clobber the version. */ |
|
388 |
if (p = strchr(dd->entry.d_name, ';')) |
|
389 |
*p = '\0'; |
|
390 |
||
2982 | 391 |
/* claus: empty dirs seems to leave *.* in the buffer ... */ |
392 |
if (strcmp(dd->entry.d_name, "*.*") == 0) { |
|
393 |
return NULL; |
|
394 |
} |
|
395 |
||
438 | 396 |
dd->entry.d_namlen = strlen(dd->entry.d_name); |
397 |
||
398 |
dd->entry.vms_verscount = 0; |
|
399 |
if (dd->vms_wantversions) |
|
400 |
collectversions(dd); |
|
401 |
return &dd->entry; |
|
402 |
} |
|
403 |
||
404 |
/* |
|
405 |
** Return something that can be used in a seekdir later. |
|
406 |
*/ |
|
407 |
long |
|
408 |
telldir(dd) |
|
2957 | 409 |
DIR *dd; |
438 | 410 |
{ |
411 |
return dd->context; |
|
412 |
} |
|
413 |
||
414 |
/* |
|
415 |
** Return to a spot where we used to be. |
|
416 |
*/ |
|
417 |
void |
|
418 |
seekdir(dd, pos) |
|
2957 | 419 |
DIR *dd; |
420 |
long pos; |
|
438 | 421 |
{ |
422 |
dd->context = pos; |
|
423 |
} |
|
424 |
||
2896 | 425 |
# define HAS_OPENDIR |
426 |
||
427 |
# endif /* __VMS__ */ |
|
428 |
#endif /* not HAS_OPENDIR */ |
|
438 | 429 |
%} |
430 |
! ! |
|
431 |
||
613 | 432 |
!DirectoryStream class methodsFor:'documentation'! |
433 |
||
434 |
copyright |
|
435 |
" |
|
436 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
437 |
All Rights Reserved |
|
1 | 438 |
|
613 | 439 |
This software is furnished under a license and may be used |
440 |
only in accordance with the terms of that license and with the |
|
441 |
inclusion of the above copyright notice. This software may not |
|
442 |
be provided or otherwise made available to, or used by, any |
|
443 |
other person. No title to or ownership of the software is |
|
444 |
hereby transferred. |
|
445 |
" |
|
446 |
! |
|
360 | 447 |
|
613 | 448 |
documentation |
449 |
" |
|
450 |
Instances of DirectoryStream allow reading a file-directory, |
|
451 |
as if it was a stream of filenames. |
|
452 |
Basically, its an interface to opendir, readdir and closedir. |
|
2957 | 453 |
Notice: |
454 |
DirectoryStream is an ST/X special; |
|
455 |
for portability, we recommend the use of Filename protocol. |
|
1295 | 456 |
|
457 |
[author:] |
|
1631 | 458 |
Claus Gittinger |
2957 | 459 |
|
460 |
[see also:] |
|
461 |
Filename |
|
613 | 462 |
" |
1 | 463 |
! ! |
464 |
||
465 |
!DirectoryStream class methodsFor:'instance creation'! |
|
466 |
||
467 |
directoryNamed:dirName |
|
7826 | 468 |
"return a DirectoryStream for directory named dirName, aString |
469 |
Raises an openError, if the directory does not exists." |
|
1 | 470 |
|
471 |
|newStream| |
|
472 |
||
473 |
newStream := (self basicNew) pathName:dirName. |
|
474 |
newStream openForReading isNil ifTrue:[^nil]. |
|
475 |
^ newStream |
|
7826 | 476 |
|
477 |
" |
|
478 |
self directoryNamed:'adadasd' |
|
479 |
" |
|
1 | 480 |
! ! |
481 |
||
5245 | 482 |
!DirectoryStream methodsFor:'access-reading'! |
1 | 483 |
|
484 |
nextLine |
|
485 |
"return the next filename as a string" |
|
486 |
||
487 |
|prevEntry nextEntry| |
|
488 |
%{ |
|
77 | 489 |
#ifdef HAS_OPENDIR |
1 | 490 |
DIR *d; |
1631 | 491 |
# ifdef NEXT |
1 | 492 |
struct direct *dp; |
1631 | 493 |
# else |
1 | 494 |
struct dirent *dp; |
1631 | 495 |
# endif |
92 | 496 |
OBJ dirP; |
1 | 497 |
|
1281
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
498 |
if (__INST(hitEOF) != true && (dirP = __INST(dirPointer)) != nil) { |
1631 | 499 |
__INST(lastErrorNumber) = nil; |
500 |
d = (DIR *)__FILEVal(dirP); |
|
92 | 501 |
|
1631 | 502 |
__BEGIN_INTERRUPTABLE__ |
503 |
do { |
|
2957 | 504 |
do { |
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
505 |
__threadErrno = 0; |
3816
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
506 |
dp = readdir(d); |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
507 |
/* |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
508 |
* for compatibility with ST-80, |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
509 |
* skip entries for '.' and '..'. |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
510 |
* If wanted, these must be added synthetically. |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
511 |
*/ |
2957 | 512 |
} while (dp && ((strcmp(dp->d_name, ".")==0) || (strcmp(dp->d_name, "..")==0))); |
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
513 |
} while ((dp == NULL) && (__threadErrno == EINTR)); |
1631 | 514 |
__END_INTERRUPTABLE__ |
92 | 515 |
|
1631 | 516 |
if (dp != NULL) { |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1664
diff
changeset
|
517 |
nextEntry = __MKSTRING((char *)(dp->d_name)); |
1631 | 518 |
} else { |
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
519 |
if (__threadErrno) { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
520 |
__INST(lastErrorNumber) = __MKSMALLINT(__threadErrno); |
1631 | 521 |
} else { |
522 |
__INST(hitEOF) = true; |
|
523 |
} |
|
1281
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
524 |
} |
1 | 525 |
} |
1631 | 526 |
#else /* no HAS_OPENDIR */ |
527 |
# ifdef WIN32 |
|
528 |
HANDLE d; |
|
529 |
WIN32_FIND_DATA data; |
|
530 |
OBJ dirP; |
|
3816
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
531 |
int rslt; |
1631 | 532 |
|
533 |
if (__INST(hitEOF) != true && (dirP = __INST(dirPointer)) != nil) { |
|
534 |
__INST(lastErrorNumber) = nil; |
|
535 |
d = __HANDLEVal(dirP); |
|
536 |
||
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
537 |
do { |
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
538 |
__threadErrno = 0; |
6268 | 539 |
rslt = STX_API_CALL2( "FindNextFile", FindNextFile, d, &data ); |
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
540 |
} while ((rslt < 0) && (__threadErrno == EINTR)); |
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
541 |
|
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
542 |
if (rslt > 0) { |
1631 | 543 |
nextEntry = __MKSTRING( data.cFileName ); |
544 |
} else { |
|
545 |
__INST(hitEOF) = true; |
|
546 |
} |
|
547 |
} |
|
548 |
# endif /* WIN32 */ |
|
549 |
#endif /* HAS_OPENDIR */ |
|
155 | 550 |
%}. |
551 |
lastErrorNumber notNil ifTrue:[^ self ioError]. |
|
1664 | 552 |
prevEntry := readAheadEntry. |
553 |
readAheadEntry := nextEntry. |
|
1281
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
554 |
prevEntry isNil ifTrue:[^ self pastEnd]. |
1 | 555 |
^ prevEntry |
556 |
! ! |
|
557 |
||
613 | 558 |
!DirectoryStream methodsFor:'closing'! |
559 |
||
560 |
close |
|
561 |
"close the stream - tell operating system" |
|
562 |
||
563 |
dirPointer notNil ifTrue:[ |
|
564 |
Lobby unregister:self. |
|
565 |
self closeFile. |
|
566 |
dirPointer := nil |
|
567 |
] |
|
568 |
! ! |
|
569 |
||
570 |
!DirectoryStream methodsFor:'instance release'! |
|
571 |
||
572 |
closeFile |
|
573 |
"low level close of a directoryStream" |
|
574 |
%{ |
|
575 |
#ifdef HAS_OPENDIR |
|
576 |
OBJ dp; |
|
577 |
||
1133 | 578 |
if ((dp = __INST(dirPointer)) != nil) { |
579 |
__INST(dirPointer) = nil; |
|
613 | 580 |
closedir( (DIR *)(__FILEVal(dp)) ); |
581 |
} |
|
1631 | 582 |
#else |
583 |
# ifdef WIN32 |
|
584 |
OBJ dp; |
|
585 |
||
586 |
if ((dp = __INST(dirPointer)) != nil) { |
|
587 |
__INST(dirPointer) = nil; |
|
588 |
FindClose( __HANDLEVal(dp) ); |
|
589 |
} |
|
590 |
# endif |
|
613 | 591 |
#endif |
592 |
%} |
|
593 |
! ! |
|
594 |
||
1 | 595 |
!DirectoryStream methodsFor:'private'! |
596 |
||
597 |
openForReading |
|
598 |
"open the file for readonly" |
|
599 |
||
1631 | 600 |
|ok entry| |
1 | 601 |
|
602 |
mode := #readonly. |
|
603 |
%{ |
|
77 | 604 |
#ifdef HAS_OPENDIR |
1 | 605 |
DIR *d; |
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
475
diff
changeset
|
606 |
OBJ path, dp; |
1 | 607 |
|
155 | 608 |
ok = false; |
1133 | 609 |
if (__INST(dirPointer) == nil) { |
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
610 |
path = __INST(pathName); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
611 |
if (__isString(path)) { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
612 |
__BEGIN_INTERRUPTABLE__ |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
613 |
__threadErrno = 0; |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
614 |
do { |
6268 | 615 |
path = __INST(pathName); |
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
616 |
d = opendir((char *) __stringVal(path)); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
617 |
} while ((d == NULL) && (__threadErrno == EINTR)); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
618 |
__END_INTERRUPTABLE__ |
92 | 619 |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
620 |
if (d == NULL) { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
621 |
__INST(lastErrorNumber) = __MKSMALLINT(__threadErrno); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
622 |
} else { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
623 |
__INST(dirPointer) = dp = __MKEXTERNALADDRESS(d); __STORE(self, dp); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
624 |
ok = true; |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
625 |
} |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
626 |
} |
1 | 627 |
} |
1631 | 628 |
#else |
629 |
# ifdef WIN32 |
|
630 |
HANDLE d; |
|
631 |
OBJ path, dp; |
|
632 |
char pattern[512]; |
|
633 |
WIN32_FIND_DATA data; |
|
634 |
||
635 |
ok = false; |
|
636 |
if (__INST(dirPointer) == nil) { |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
637 |
path = __INST(pathName); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
638 |
if (__isString(path)) { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
639 |
int l = __stringSize(path); |
3164
4f37ae9c8961
use strncpy to avoid buffer-overruns
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
640 |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
641 |
if (l < (sizeof(pattern)-4)) { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
642 |
strncpy(pattern, __stringVal(path), l); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
643 |
strcpy(pattern+l, "\\*"); |
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
644 |
|
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
645 |
do { |
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
646 |
__threadErrno = 0; |
6268 | 647 |
d = STX_API_CALL2( "FindFirstFile", FindFirstFile, pattern, &data ); |
6259
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
648 |
} while ((d < 0) && (__threadErrno == EINTR)); |
164d7efc1eb2
api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents:
5245
diff
changeset
|
649 |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
650 |
if (d == INVALID_HANDLE_VALUE) { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
651 |
__INST(lastErrorNumber) = __MKSMALLINT(GetLastError()); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
652 |
} else { |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
653 |
__INST(dirPointer) = dp = __MKEXTERNALADDRESS(d); __STORE(self, dp); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
654 |
entry = __MKSTRING( data.cFileName ); |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
655 |
ok = true; |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
656 |
} |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
657 |
} |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
658 |
} |
1631 | 659 |
} |
660 |
# endif |
|
1 | 661 |
#endif |
155 | 662 |
%}. |
663 |
ok isNil ifTrue:[ |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
664 |
" |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
665 |
opendir not avalable - use slower pipe |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
666 |
" |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
667 |
^ PipeStream readingFrom:('cd ' , pathName , '; ls -a') |
1 | 668 |
]. |
155 | 669 |
|
670 |
(ok == true) ifTrue:[ |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
671 |
Lobby register:self. |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
672 |
entry isNil ifTrue:[ |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
673 |
self nextLine. "read 1st entry into readAheadEntry buffer" |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
674 |
] ifFalse:[ |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
675 |
readAheadEntry := entry. |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
676 |
]. |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4526
diff
changeset
|
677 |
^ self |
1 | 678 |
]. |
4526
a42dc8e09586
errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents:
4298
diff
changeset
|
679 |
dirPointer notNil ifTrue:[^ self errorAlreadyOpen]. |
155 | 680 |
lastErrorNumber notNil ifTrue:[^ self openError]. |
1 | 681 |
^ nil |
682 |
! |
|
683 |
||
684 |
reOpen |
|
38 | 685 |
"reOpen the stream after image restart" |
686 |
||
2 | 687 |
dirPointer := nil. |
688 |
super reOpen |
|
1 | 689 |
! ! |
690 |
||
691 |
!DirectoryStream methodsFor:'testing'! |
|
692 |
||
693 |
atEnd |
|
694 |
"return true, if position is at end" |
|
695 |
||
1664 | 696 |
^ readAheadEntry == nil |
2945
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
697 |
! |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
698 |
|
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
699 |
isEmpty |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
700 |
"test for if the unread portion of the directory stream is empty. |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
701 |
This query changes the readPointer of the DirectoryStream" |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
702 |
|
2957 | 703 |
|entry| |
2945
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
704 |
|
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
705 |
[self atEnd] whileFalse:[ |
3816
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
706 |
entry := self nextLine. |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
707 |
entry asFilename isImplicit ifFalse:[ |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
708 |
^ false. |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
709 |
] |
2945
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
710 |
]. |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
711 |
^ true |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
712 |
|
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
713 |
|
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
714 |
" |
3816
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
715 |
(DirectoryStream directoryNamed:'/') isEmpty |
af3f917c7759
use wrapCalls for FindFirstFile & FindNextFile (win32 - dir-reading)
Claus Gittinger <cg@exept.de>
parents:
3164
diff
changeset
|
716 |
(DirectoryStream directoryNamed:'/var/tmp') isEmpty |
2945
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
717 |
" |
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
718 |
|
1a4f2e0d9f1b
Add #isEmpty, to check for an empty directory.
Stefan Vogel <sv@exept.de>
parents:
2896
diff
changeset
|
719 |
"Modified: 18.9.1997 / 18:05:31 / stefan" |
1 | 720 |
! ! |
721 |
||
1281
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
722 |
!DirectoryStream class methodsFor:'documentation'! |
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
723 |
|
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
724 |
version |
7826 | 725 |
^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.54 2004-01-14 12:56:39 cg Exp $' |
1281
b4b3abffdf32
Support optional signal generation on end of stream.
Stefan Vogel <sv@exept.de>
parents:
1133
diff
changeset
|
726 |
! ! |