* mu-cmd-extract.c: only check for writability of targetdir if we're actually
going to write something; this fixes running unit tests in a unwritable env
This commit is contained in:
@ -262,12 +262,6 @@ check_params (MuConfig *opts)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mu_util_check_dir(opts->targetdir, FALSE, TRUE)) {
|
|
||||||
g_warning ("target '%s' is not a writable directory",
|
|
||||||
opts->targetdir);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts->save_attachments && opts->save_all) {
|
if (opts->save_attachments && opts->save_all) {
|
||||||
g_warning ("only one of --save-attachments and"
|
g_warning ("only one of --save-attachments and"
|
||||||
" --save-all is allowed");
|
" --save-all is allowed");
|
||||||
@ -299,8 +293,14 @@ mu_cmd_extract (MuConfig *opts)
|
|||||||
!opts->save_attachments &&
|
!opts->save_attachments &&
|
||||||
!opts->save_all) /* show, don't save */
|
!opts->save_all) /* show, don't save */
|
||||||
rv = show_parts (opts->params[1], opts);
|
rv = show_parts (opts->params[1], opts);
|
||||||
|
else {
|
||||||
|
rv = mu_util_check_dir(opts->targetdir, FALSE, TRUE);
|
||||||
|
if (!rv)
|
||||||
|
g_warning ("target '%s' is not a writable directory",
|
||||||
|
opts->targetdir);
|
||||||
else
|
else
|
||||||
rv = save_parts (opts->params[1], opts); /* save */
|
rv = save_parts (opts->params[1], opts); /* save */
|
||||||
|
}
|
||||||
|
|
||||||
return rv ? MU_EXITCODE_OK : MU_EXITCODE_ERROR;
|
return rv ? MU_EXITCODE_OK : MU_EXITCODE_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user