Skip to content

Commit

Permalink
Make verbosity of --appimage-extract-and-run configurable
Browse files Browse the repository at this point in the history
Fixes #1002.
  • Loading branch information
TheAssassin committed Nov 8, 2019
1 parent 801e789 commit 91b44f6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ portable_option(const char *arg, const char *appimage_path, const char *name)
}
}

bool extract_appimage(const char* const appimage_path, const char* const _prefix, const char* const _pattern, const bool overwrite) {
bool extract_appimage(const char* const appimage_path, const char* const _prefix, const char* const _pattern, const bool overwrite, const bool verbose) {
sqfs_err err = SQFS_OK;
sqfs_traverse trv;
sqfs fs;
Expand Down Expand Up @@ -331,7 +331,10 @@ bool extract_appimage(const char* const appimage_path, const char* const _prefix
// fprintf(stderr, "inode.xtra.reg.file_size: %lu\n", inode.xtra.reg.file_size);
strcpy(prefixed_path_to_extract, "");
strcat(strcat(prefixed_path_to_extract, prefix), trv.path);
fprintf(stdout, "%s\n", prefixed_path_to_extract);

if (verbose)
fprintf(stdout, "%s\n", prefixed_path_to_extract);

if (inode.base.inode_type == SQUASHFS_DIR_TYPE || inode.base.inode_type == SQUASHFS_LDIR_TYPE) {
// fprintf(stderr, "inode.xtra.dir.parent_inode: %ui\n", inode.xtra.dir.parent_inode);
// fprintf(stderr, "mkdir_p: %s/\n", prefixed_path_to_extract);
Expand Down Expand Up @@ -633,7 +636,7 @@ int main(int argc, char *argv[]) {
exit(1);
}

if (!extract_appimage(appimage_path, "squashfs-root/", pattern, true)) {
if (!extract_appimage(appimage_path, "squashfs-root/", pattern, true, true)) {
exit(1);
}

Expand Down Expand Up @@ -694,7 +697,9 @@ int main(int argc, char *argv[]) {
strcat(prefix, hexlified_digest);
free(hexlified_digest);

if (!extract_appimage(appimage_path, prefix, NULL, false)) {
const bool verbose = (getenv("VERBOSE") != NULL);

if (!extract_appimage(appimage_path, prefix, NULL, false, verbose)) {
fprintf(stderr, "Failed to extract AppImage\n");
exit(EXIT_EXECERROR);
}
Expand Down

0 comments on commit 91b44f6

Please sign in to comment.