mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-05 20:26:46 +02:00
more succinct way to get file sizes
This commit is contained in:
@ -311,3 +311,14 @@ bool file_exists(const char *path)
|
||||
struct stat s;
|
||||
return stat(path, &s) == 0;
|
||||
}
|
||||
|
||||
/* returns file size or -1 on error */
|
||||
uint64_t file_size(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path, &st) == -1)
|
||||
return -1;
|
||||
|
||||
return (uint64_t) st.st_size;
|
||||
}
|
||||
|
Reference in New Issue
Block a user