Skip to content

Commit

Permalink
Add '?' sign as a possible mark of wildcard.
Browse files Browse the repository at this point in the history
Signed-off-by: Slava Zanko <[email protected]>
  • Loading branch information
slavaz committed Feb 25, 2015
1 parent ec0dd74 commit 4d2cefa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/filemanager/filegui.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
static gboolean
is_wildcarded (const char *p)
{
int escaped = 0;
gboolean escaped = FALSE;
for (; *p; p++)
{
if (*p == '\\')
Expand All @@ -623,9 +623,9 @@ is_wildcarded (const char *p)
}
else
{
if (*p == '*' && !escaped)
if ((*p == '*' || *p == '?') && !escaped)
return TRUE;
escaped = 0;
escaped = FALSE;
}
}
return FALSE;
Expand Down
10 changes: 9 additions & 1 deletion tests/src/filemanager/filegui_is_wildcarded.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static const struct test_is_wildcarded_ds
},
{ /* 1 */
"bla?bla",
FALSE
TRUE
},
{ /* 2 */
"bla*bla",
Expand Down Expand Up @@ -110,6 +110,14 @@ static const struct test_is_wildcarded_ds
"blabla\\",
FALSE
},
{ /* 11 */
"blab\\?la",
FALSE
},
{ /* 12 */
"blab\\\\?la",
TRUE
},
};
/* *INDENT-ON* */

Expand Down

0 comments on commit 4d2cefa

Please sign in to comment.