Header - File operations. More...
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
off_t | file_filesize (const char *filename) |
get size of a file | |
off_t | file_filesize_f (FILE *f) |
get size of an opened file | |
void | file_path_explode (char *path, char **dir, char **file, char **ext) |
modify path to directory, file and extension string - path is destroyed | |
bool | file_set_context (const char *device) |
set the working directory (the device where a db5 database is) | |
bool | file_exists (const char *path) |
test if the file exists | |
const char * | file_remove_headslash (const char *path) |
test if the file exists | |
const char * | file_get_extension (const char *path) |
return extension of a file (incluing dot) | |
void | file_windows_slashes (char *path) |
alter a path string to turn slashes to counterslashes | |
FILE * | file_fcaseopen (const char *directory, const char *filename, const char *mode) |
open the first file that match to specified filename without case sensitivity | |
bool | file_truncate (FILE *f, const off_t len) |
truncate a file | |
Variables | |
char | file_common_buffer [10240] |
shared buffer for file operation |
Header - File operations.
Definition in file file.h.
bool file_exists | ( | const char * | path | ) |
test if the file exists
path | to filename - utf8 |
Definition at line 97 of file file.c.
References check.
Referenced by db5_generate_row().
FILE* file_fcaseopen | ( | const char * | directory, | |
const char * | filename, | |||
const char * | mode | |||
) |
open the first file that match to specified filename without case sensitivity
directory | the directory where file must be found - utf8 | |
filename | the filename to try to find - utf8 | |
mode | file mode |
Definition at line 147 of file file.c.
References add_log(), ADDLOG_DUMP, ADDLOG_FAIL, ADDLOG_RECOVER, check, and log_dump().
Referenced by db5_dat_init(), db5_hdr_init(), db5_index_index_column(), names_init(), and names_save().
off_t file_filesize | ( | const char * | filename | ) |
get size of a file
filename | the path to file - utf8 |
Definition at line 24 of file file.c.
References add_log(), ADDLOG_FAIL, check, and log_dump().
Referenced by asf_generate_row().
off_t file_filesize_f | ( | FILE * | f | ) |
get size of an opened file
f | an opened file |
Definition at line 40 of file file.c.
References add_log(), ADDLOG_FAIL, and check.
const char* file_get_extension | ( | const char * | path | ) |
return extension of a file (incluing dot)
path | filename/path to get extension - utf8 or latin1 |
Definition at line 116 of file file.c.
References check.
Referenced by names_generate_shortname(), and names_select_shortname().
void file_path_explode | ( | char * | path, | |
char ** | dir, | |||
char ** | file, | |||
char ** | ext | |||
) |
modify path to directory, file and extension string - path is destroyed
path | the path to explode in directory, file and extension - destroyed - utf8 or latin1 | |
dir | directory pointer address - path's charset | |
file | file pointer address - path's charset | |
ext | extension pointer address - path's charset |
Definition at line 55 of file file.c.
References check.
Referenced by db5_generate_row().
const char* file_remove_headslash | ( | const char * | path | ) |
test if the file exists
path | to filename - utf8 or latin1 |
Definition at line 104 of file file.c.
References check.
Referenced by fuse_impl_create(), fuse_impl_flush(), fuse_impl_getattr(), fuse_impl_open(), fuse_impl_rename(), fuse_impl_truncate(), fuse_impl_unlink(), and fuse_impl_utimens().
bool file_set_context | ( | const char * | device | ) |
set the working directory (the device where a db5 database is)
device | the device where we want to fix working directory - utf8 |
Definition at line 83 of file file.c.
References add_log(), ADDLOG_FAIL, check, and log_dump().
Referenced by fuse_impl_init().
bool file_truncate | ( | FILE * | f, | |
const off_t | len | |||
) |
truncate a file
f | file to truncate | |
len | new size of file |
Definition at line 190 of file file.c.
References add_log(), ADDLOG_FAIL, and check.
Referenced by db5_dat_delete_row().
void file_windows_slashes | ( | char * | path | ) |
alter a path string to turn slashes to counterslashes
path | filename/path to turn slashes - utf8 or latin1 |
Definition at line 133 of file file.c.
References check.
Referenced by db5_generate_row().