[AD] Fix description of file_select_ex() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Spotted by visual inspection of fsel.c:fs_flist_putter(), more specifically
this chunk of code
/* check if file attributes match */
if (!(attr_flag[3+5] & attrib)) {
/* if not a directory, we check all attributes except FA_DIREC */
for (c=0; c<5; c++) {
if (c == 3)
continue;
if ((attr_flag[c] == 1) && (!(attrib & attr_flag[c+5])))
return;
if ((attr_flag[c] == -1) && (attrib & attr_flag[c+5]))
return;
}
}
else {
/* if a directory, we check only FA_DIREC */
if (attr_flag[3] == -1)
return;
}
and confirmed by a testcase: contrary to what is advertised, the file
attribute characters "rhsda" are not equivalent for the file selector. More
precisely, the "d" (directory) is singled out to allow browsing the
directory tree.
Patch applied to trunk and branch.
Note that
/* if not a directory, we check all attributes except FA_DIREC */
if (c == 3)
continue;
means that '+d' has no effect, which is redundant with no occurence of 'd'.
Does anyone see a rationale for this behaviour? If no, I propose that we
restore the symmetry and allow '+d' to mean 'directories only' for the 4.1.x
series.
--
Eric Botcazou
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.150
diff -u -r1.150 allegro._tx
--- docs/src/allegro._tx 13 May 2003 16:57:58 -0000 1.150
+++ docs/src/allegro._tx 13 May 2003 22:28:42 -0000
@@ -7994,18 +7994,20 @@
Passing NULL includes all files; "PCX;BMP" includes only files with
.PCX or .BMP extensions. If you wish to control files by their attributes,
one of the fields in the extension list can begin with a slash, followed
- by a set of attribute characters. Any attributes written on their own,
- or with a '+' before them, indicate to include only files which have
- that attribute set. Any attributes with a '-' before them indicate to
- leave out any files with that attribute. The flag characters are
- 'r' (read-only), 'h' (hidden), 's' (system), 'd' (directory),
- and 'a' (archive). For example, an extension string of "PCX;BMP;/+r-d"
- will display only PCX or BMP files that are read-only, and no
- directories. The file selector is stretched to the width and height
- specified in the w and h parameters, and to the size of the standard
- Allegro font. If either the width or height argument is set to zero, it is
- stretched to the corresponding screen dimension. This function returns
- zero if it was closed with the Cancel button or non-zero if it was OK'd.
+ by a set of attribute characters. Any attribute written on its own, or
+ with a '+' before it, indicates to include only files which have that
+ attribute set. Any attribute with a '-' before it indicates to leave out
+ any files with that attribute. The flag characters are 'r' (read-only),
+ 'h' (hidden), 's' (system) and 'a' (archive). For example, an extension
+ string of "PCX;BMP;/+r-h" will display only PCX or BMP files that are
+ read-only and not hidden. The directories are not affected by the set of
+ attribute characters, i.e they will always be all included, unless the set
+ contains '-d' in which case none will be included. The file selector is
+ stretched to the width and height specified in the w and h parameters,
+ and to the size of the standard Allegro font. If either the width or
+ height argument is set to zero, it is stretched to the corresponding
+ screen dimension. This function returns zero if it was closed with the
+ Cancel button or non-zero if it was OK'd.
@@int @gfx_mode_select(int *card, int *w, int *h);
@xref gfx_mode_select_ex, set_gfx_mode, gui_fg_color