* 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:
Dirk-Jan C. Binnema 2011-01-31 09:13:26 +02:00
parent 354cc421ea
commit 5997973d41
1 changed files with 10 additions and 10 deletions

View File

@ -262,12 +262,6 @@ check_params (MuConfig *opts)
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) {
g_warning ("only one of --save-attachments and"
" --save-all is allowed");
@ -299,8 +293,14 @@ mu_cmd_extract (MuConfig *opts)
!opts->save_attachments &&
!opts->save_all) /* show, don't save */
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
rv = save_parts (opts->params[1], opts); /* save */
}
return rv ? MU_EXITCODE_OK : MU_EXITCODE_ERROR;
}