Mercurial > geeqie
comparison src/filedata.c @ 951:6ce7133c730d
Move dest_dir variable to inner block.
author | zas_ |
---|---|
date | Mon, 28 Jul 2008 17:55:06 +0000 |
parents | c32b6393b21d |
children | 77a1d5a0326d |
comparison
equal
deleted
inserted
replaced
950:c32b6393b21d | 951:6ce7133c730d |
---|---|
1554 | 1554 |
1555 gint file_data_verify_ci(FileData *fd) | 1555 gint file_data_verify_ci(FileData *fd) |
1556 { | 1556 { |
1557 gint ret = CHANGE_OK; | 1557 gint ret = CHANGE_OK; |
1558 gchar *dir; | 1558 gchar *dir; |
1559 gchar *dest_dir = NULL; | |
1560 | 1559 |
1561 if (!fd->change) | 1560 if (!fd->change) |
1562 { | 1561 { |
1563 DEBUG_1("Change checked: no change info: %s", fd->path); | 1562 DEBUG_1("Change checked: no change info: %s", fd->path); |
1564 return ret; | 1563 return ret; |
1572 return ret; | 1571 return ret; |
1573 } | 1572 } |
1574 | 1573 |
1575 dir = remove_level_from_path(fd->path); | 1574 dir = remove_level_from_path(fd->path); |
1576 | 1575 |
1577 if (fd->change->dest) dest_dir = remove_level_from_path(fd->change->dest); | |
1578 | |
1579 if (fd->change->type != FILEDATA_CHANGE_DELETE && | 1576 if (fd->change->type != FILEDATA_CHANGE_DELETE && |
1580 !access_file(fd->path, R_OK)) | 1577 !access_file(fd->path, R_OK)) |
1581 { | 1578 { |
1582 ret |= CHANGE_NO_READ_PERM; | 1579 ret |= CHANGE_NO_READ_PERM; |
1583 DEBUG_1("Change checked: no read permission: %s", fd->path); | 1580 DEBUG_1("Change checked: no read permission: %s", fd->path); |
1596 DEBUG_1("Change checked: no write permission: %s", fd->path); | 1593 DEBUG_1("Change checked: no write permission: %s", fd->path); |
1597 } | 1594 } |
1598 | 1595 |
1599 if (fd->change->dest) | 1596 if (fd->change->dest) |
1600 { | 1597 { |
1598 gchar *dest_dir; | |
1601 const gchar *dest_ext = extension_from_path(fd->change->dest); | 1599 const gchar *dest_ext = extension_from_path(fd->change->dest); |
1602 if (!dest_ext) dest_ext = ""; | 1600 if (!dest_ext) dest_ext = ""; |
1603 | 1601 |
1604 if (strcasecmp(fd->extension, dest_ext) != 0) | 1602 if (strcasecmp(fd->extension, dest_ext) != 0) |
1605 { | 1603 { |
1612 { | 1610 { |
1613 ret |= CHANGE_WARN_SAME; | 1611 ret |= CHANGE_WARN_SAME; |
1614 DEBUG_1("Change checked: source and destination are the same: %s -> %s", fd->path, fd->change->dest); | 1612 DEBUG_1("Change checked: source and destination are the same: %s -> %s", fd->path, fd->change->dest); |
1615 } | 1613 } |
1616 | 1614 |
1615 dest_dir = remove_level_from_path(fd->change->dest); | |
1616 | |
1617 if (!isdir(dest_dir)) | 1617 if (!isdir(dest_dir)) |
1618 { | 1618 { |
1619 ret |= CHANGE_NO_DEST_DIR; | 1619 ret |= CHANGE_NO_DEST_DIR; |
1620 DEBUG_1("Change checked: destination dir does not exist: %s -> %s", fd->path, fd->change->dest); | 1620 DEBUG_1("Change checked: destination dir does not exist: %s -> %s", fd->path, fd->change->dest); |
1621 } | 1621 } |
1637 else if (isdir(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0)) | 1637 else if (isdir(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0)) |
1638 { | 1638 { |
1639 ret |= CHANGE_DEST_EXISTS; | 1639 ret |= CHANGE_DEST_EXISTS; |
1640 DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); | 1640 DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); |
1641 } | 1641 } |
1642 | |
1643 g_free(dest_dir); | |
1642 } | 1644 } |
1643 | 1645 |
1644 fd->change->error = ret; | 1646 fd->change->error = ret; |
1645 if (ret == 0) DEBUG_1("Change checked: OK: %s", fd->path); | 1647 if (ret == 0) DEBUG_1("Change checked: OK: %s", fd->path); |
1646 | 1648 |
1647 g_free(dir); | 1649 g_free(dir); |
1648 g_free(dest_dir); | |
1649 return ret; | 1650 return ret; |
1650 } | 1651 } |
1651 | 1652 |
1652 | 1653 |
1653 gint file_data_sc_verify_ci(FileData *fd) | 1654 gint file_data_sc_verify_ci(FileData *fd) |