2002-02-26 Lutz M�ller <lutz@users.sourceforge.net>

* directory.c (delete_file_func): In case of error, tell the user
          what went wrong.


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4224 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Lutz Mueller
2002-02-26 10:08:22 +00:00
parent 98f48a41c3
commit 4feddd7a49
2 changed files with 12 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2002-02-26 Lutz Müller <lutz@users.sourceforge.net>
* directory.c (delete_file_func): In case of error, tell the user
what went wrong.
2002-02-13 Dan Fandrich <dan@coneharvesters.com>
* directory.c: Now using MIME type macros. Replaced // comment.

View File

@@ -551,13 +551,19 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
const char *file, void *data, GPContext *context)
{
char path[2048];
int result;
if (strlen (folder) > 1)
snprintf (path, sizeof (path), "%s/%s", folder, file);
else
snprintf (path, sizeof (path), "/%s", file);
if (unlink (path))
result = unlink (path);
if (result) {
gp_context_error (context, _("Could not delete file '%s' "
"in folder '%s' (error code %i: %m)."),
file, folder, result);
return (GP_ERROR);
}
return (GP_OK);
}