libobs/util: Add function to get file size
From pull request: jp9000/obs-studio#374
This commit is contained in:
@@ -282,6 +282,18 @@ cleanup:
|
||||
return success;
|
||||
}
|
||||
|
||||
int64_t os_get_file_size(const char *path)
|
||||
{
|
||||
FILE* f = os_fopen(path, "rb");
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
int64_t sz = os_fgetsize(f);
|
||||
fclose(f);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
size_t os_mbs_to_wcs(const char *str, size_t len, wchar_t *dst, size_t dst_size)
|
||||
{
|
||||
size_t out_len;
|
||||
|
@@ -51,6 +51,8 @@ EXPORT char *os_quick_read_mbs_file(const char *path);
|
||||
EXPORT bool os_quick_write_mbs_file(const char *path, const char *str,
|
||||
size_t len);
|
||||
|
||||
EXPORT int64_t os_get_file_size(const char *path);
|
||||
|
||||
EXPORT size_t os_mbs_to_wcs(const char *str, size_t str_len, wchar_t *dst,
|
||||
size_t dst_size);
|
||||
EXPORT size_t os_utf8_to_wcs(const char *str, size_t len, wchar_t *dst,
|
||||
|
Reference in New Issue
Block a user