Fix for issue:

When copying to directory with a name containing special symbol "*" the copy command didn't do it in a right way.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Boris Savelev 2015-02-25 12:01:22 +03:00 committed by Slava Zanko
parent dbbd8a7cdc
commit ec0dd74248
2 changed files with 27 additions and 18 deletions

View File

@ -612,12 +612,21 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
static gboolean
is_wildcarded (const char *p)
{
int escaped = 0;
for (; *p; p++)
{
if (*p == '*')
return TRUE;
if (*p == '\\' && p[1] >= '1' && p[1] <= '9')
return TRUE;
if (*p == '\\')
{
if (p[1] >= '1' && p[1] <= '9' && !escaped)
return TRUE;
escaped = !escaped;
}
else
{
if (*p == '*' && !escaped)
return TRUE;
escaped = 0;
}
}
return FALSE;
}

View File

@ -65,48 +65,48 @@ static const struct test_is_wildcarded_ds
gboolean expected_result;
} test_is_wildcarded_ds[] =
{
{
{ /* 0 */
"blabla",
FALSE
},
{
{ /* 1 */
"bla?bla",
FALSE
},
{
{ /* 2 */
"bla*bla",
TRUE
},
{
{ /* 3 */
"bla\\*bla",
TRUE
FALSE
},
{
{ /* 4 */
"bla\\\\*bla",
TRUE
},
{
{ /* 5 */
"bla\\1bla",
TRUE
},
{
{ /* 6 */
"bla\\\\1bla",
TRUE
FALSE
},
{
{ /* 7 */
"bla\\\t\\\\1bla",
TRUE
FALSE
},
{
{ /* 8 */
"bla\\\t\\\\\\1bla",
TRUE
},
{
{ /* 9 */
"bla\\9bla",
TRUE
},
{
{ /* 10 */
"blabla\\",
FALSE
},