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