libobs/util: Add function to get file size

From pull request: jp9000/obs-studio#374
This commit is contained in:
adray
2015-02-20 22:50:51 +00:00
committed by jp9000
parent d542663478
commit 3e6db990fc
2 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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,