naev 0.11.5
nfile.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
7#include <stdint.h>
10#include "array.h"
11#include "attributes.h"
12
13SENTINEL( 0 ) int _nfile_concatPaths( char buf[ static 1 ], int maxLength, const char path[ static 1 ], ... );
23#define nfile_concatPaths( buf, maxLength, path, ... ) _nfile_concatPaths( buf, maxLength, path, ##__VA_ARGS__, NULL )
24
25const char *nfile_configPath( void );
26const char *nfile_cachePath( void );
27
28int nfile_dirMakeExist( const char *path );
29int nfile_dirExists( const char *path );
30int nfile_fileExists( const char *path ); /* Returns 1 on exists */
31int nfile_backupIfExists( const char *path );
32int nfile_copyIfExists( const char *path1, const char *path2 );
33char *nfile_readFile( size_t *filesize, const char *path );
34int nfile_touch( const char *path );
35int nfile_writeFile( const char *data, size_t len, const char *path );
36int nfile_isSeparator( uint32_t c );
Provides macros to work with dynamic arrays.
int nfile_copyIfExists(const char *file1, const char *file2)
Copy a file, if it exists.
Definition nfile.c:365
const char * nfile_configPath(void)
Gets Naev's config path (for user preferences such as conf.lua)
Definition nfile.c:116
int nfile_writeFile(const char *data, size_t len, const char *path)
Tries to write a file.
Definition nfile.c:538
char * nfile_readFile(size_t *filesize, const char *path)
Tries to read a file.
Definition nfile.c:427
int nfile_dirMakeExist(const char *path)
Creates a directory if it doesn't exist.
Definition nfile.c:267
int nfile_backupIfExists(const char *path)
Backup a file, if it exists.
Definition nfile.c:343
const char * nfile_cachePath(void)
Gets Naev's cache path (for cached data such as generated textures)
Definition nfile.c:159
int nfile_fileExists(const char *path)
Checks to see if a file exists.
Definition nfile.c:316
int nfile_touch(const char *path)
Tries to create the file if it doesn't exist.
Definition nfile.c:512
int nfile_isSeparator(uint32_t c)
Checks to see if a character is used to separate files in a path.
Definition nfile.c:581
int nfile_dirExists(const char *path)
Checks to see if a directory exists.
Definition nfile.c:296
static const double c[]
Definition rng.c:264