Skip to content

Commit

Permalink
Merge pull request #53 from Gottox/fix/easy-file-exists
Browse files Browse the repository at this point in the history
easy/file: fix file exists function
  • Loading branch information
Gottox committed Aug 21, 2023
2 parents 466fb00 + da03f0b commit ed2b8b2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/easy/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ sqsh_easy_file_exists(struct SqshArchive *archive, const char *path, int *err) {
bool exists = false;

rv = sqsh__tree_walker_init(&walker, archive);
if (rv < 0) {
goto out;
}
rv = sqsh_tree_walker_resolve(&walker, path, true);
if (rv == -SQSH_ERROR_NO_SUCH_FILE) {
rv = 0;
goto out;
} else if (rv < 0) {
goto out;
}
rv = sqsh_tree_walker_resolve(&walker, path, true);
if (rv < 0) {
goto out;
}

exists = true;

out:
sqsh__tree_walker_cleanup(&walker);
Expand Down

0 comments on commit ed2b8b2

Please sign in to comment.