提交 12dde730 编写于 作者: Y YuQing

add function fc_delete_file_ex

上级 ad570151
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册