add function fc_delete_file_ex
parent
ad57015174
commit
12dde730c8
1
HISTORY
1
HISTORY
|
|
@ -4,6 +4,7 @@ Version 1.43 2019-12-25
|
|||
system is the deprecated function in iOS 11
|
||||
* correct function skiplist_iterator in skiplist.h
|
||||
* add buffered_file_writer.[hc]
|
||||
* add function fc_delete_file_ex
|
||||
|
||||
Version 1.42 2019-12-03
|
||||
* add function get_gzip_command_filename
|
||||
|
|
|
|||
|
|
@ -2866,3 +2866,29 @@ const char *get_gzip_command_filename()
|
|||
return "gzip";
|
||||
}
|
||||
}
|
||||
|
||||
int fc_delete_file_ex(const char *filename, const char *caption)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (unlink(filename) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = errno != 0 ? errno : ENOENT;
|
||||
if (result == ENOENT)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"unlink %s file: %s fail, "
|
||||
"errno: %d, error info: %s",
|
||||
__LINE__, caption, filename,
|
||||
result, STRERROR(result));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -856,6 +856,19 @@ char *resolve_path(const char *from, const char *filename,
|
|||
*/
|
||||
const char *get_gzip_command_filename();
|
||||
|
||||
/** delete file
|
||||
* parameters:
|
||||
* filename: the filename to delete
|
||||
* caption: the caption of this filename
|
||||
* return: error no, 0 success, != 0 fail
|
||||
*/
|
||||
int fc_delete_file_ex(const char *filename, const char *caption);
|
||||
|
||||
static inline int fc_delete_file(const char *filename)
|
||||
{
|
||||
return fc_delete_file_ex(filename, "");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue