hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
fs.cpp File Reference
#include <dirent.h>
#include "fs.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <limits.h>
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
Include dependency graph for fs.cpp:

Go to the source code of this file.

Macros

#define _POSIX_C_SOURCE   200809L
 
#define _XOPEN_SOURCE   700
 
#define _CRT_SECURE_NO_WARNINGS
 
#define stat_struct   struct stat
 
#define stat_func   stat
 
#define PATH_SEPARATOR   '/'
 

Functions

static int get_stat (const char *path, stat_struct *buf)
 
bool runtime_fs_exists (const char *path)
 
bool runtime_fs_isfile (const char *path)
 
bool runtime_fs_isdir (const char *path)
 
bool runtime_fs_issymlink (const char *path)
 
int64_t runtime_fs_get_mtime (const char *path)
 
uint64_t runtime_fs_get_size (const char *path)
 
int64_t runtime_fs_get_ctime (const char *path)
 
int64_t runtime_fs_get_atime (const char *path)
 
int runtime_fs_get_uid (const char *path)
 
char * runtime_fs_temp_dir ()
 
char * runtime_fs_home_dir ()
 
char * runtime_fs_cwd ()
 
char * runtime_fs_realpath (const char *path)
 
void runtime_fs_finalize (void *res)
 
bool runtime_fs_mkdir (const char *path, int mode)
 
bool runtime_fs_rmdir (const char *path)
 
bool runtime_fs_remove (const char *path)
 
bool runtime_fs_rename (const char *old_path, const char *new_path)
 
void * runtime_fs_opendir (const char *name)
 
char * runtime_fs_readdir (void *dir)
 
void runtime_fs_closedir (void *dir)
 
bool runtime_fs_symlink (const char *src_path, const char *dest_path)
 

Macro Definition Documentation

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

Definition at line 23 of file fs.cpp.

◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE   200809L

Definition at line 21 of file fs.cpp.

◆ _XOPEN_SOURCE

#define _XOPEN_SOURCE   700

Definition at line 22 of file fs.cpp.

◆ PATH_SEPARATOR

#define PATH_SEPARATOR   '/'

Definition at line 61 of file fs.cpp.

◆ stat_func

#define stat_func   stat

Definition at line 60 of file fs.cpp.

◆ stat_struct

#define stat_struct   struct stat

Definition at line 59 of file fs.cpp.

Function Documentation

◆ get_stat()

static int get_stat ( const char *  path,
stat_struct buf 
)
static

Definition at line 64 of file fs.cpp.

References stat_func.

Referenced by runtime_fs_get_atime(), runtime_fs_get_ctime(), runtime_fs_get_mtime(), runtime_fs_get_size(), runtime_fs_get_uid(), runtime_fs_isdir(), and runtime_fs_isfile().

Here is the caller graph for this function:

◆ runtime_fs_closedir()

void runtime_fs_closedir ( void *  dir)

Definition at line 344 of file fs.cpp.

◆ runtime_fs_cwd()

char * runtime_fs_cwd ( )

Definition at line 209 of file fs.cpp.

◆ runtime_fs_exists()

bool runtime_fs_exists ( const char *  path)

Definition at line 70 of file fs.cpp.

◆ runtime_fs_finalize()

void runtime_fs_finalize ( void *  res)

Definition at line 251 of file fs.cpp.

◆ runtime_fs_get_atime()

int64_t runtime_fs_get_atime ( const char *  path)

Definition at line 127 of file fs.cpp.

References get_stat(), and stat_struct.

Here is the call graph for this function:

◆ runtime_fs_get_ctime()

int64_t runtime_fs_get_ctime ( const char *  path)

Definition at line 120 of file fs.cpp.

References get_stat(), and stat_struct.

Here is the call graph for this function:

◆ runtime_fs_get_mtime()

int64_t runtime_fs_get_mtime ( const char *  path)

Definition at line 106 of file fs.cpp.

References get_stat(), and stat_struct.

Here is the call graph for this function:

◆ runtime_fs_get_size()

uint64_t runtime_fs_get_size ( const char *  path)

Definition at line 113 of file fs.cpp.

References get_stat(), and stat_struct.

Here is the call graph for this function:

◆ runtime_fs_get_uid()

int runtime_fs_get_uid ( const char *  path)

Definition at line 134 of file fs.cpp.

References get_stat(), and stat_struct.

Here is the call graph for this function:

◆ runtime_fs_home_dir()

char * runtime_fs_home_dir ( )

Definition at line 177 of file fs.cpp.

◆ runtime_fs_isdir()

bool runtime_fs_isdir ( const char *  path)

Definition at line 85 of file fs.cpp.

References get_stat(), and stat_struct.

Referenced by runtime_fs_symlink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runtime_fs_isfile()

bool runtime_fs_isfile ( const char *  path)

Definition at line 78 of file fs.cpp.

References get_stat(), and stat_struct.

Here is the call graph for this function:

◆ runtime_fs_issymlink()

bool runtime_fs_issymlink ( const char *  path)

Definition at line 92 of file fs.cpp.

◆ runtime_fs_mkdir()

bool runtime_fs_mkdir ( const char *  path,
int  mode 
)

Definition at line 257 of file fs.cpp.

◆ runtime_fs_opendir()

void * runtime_fs_opendir ( const char *  name)

Definition at line 292 of file fs.cpp.

◆ runtime_fs_readdir()

char * runtime_fs_readdir ( void *  dir)

Definition at line 319 of file fs.cpp.

◆ runtime_fs_realpath()

char * runtime_fs_realpath ( const char *  path)

Definition at line 239 of file fs.cpp.

◆ runtime_fs_remove()

bool runtime_fs_remove ( const char *  path)

Definition at line 277 of file fs.cpp.

◆ runtime_fs_rename()

bool runtime_fs_rename ( const char *  old_path,
const char *  new_path 
)

Definition at line 288 of file fs.cpp.

◆ runtime_fs_rmdir()

bool runtime_fs_rmdir ( const char *  path)

Definition at line 267 of file fs.cpp.

◆ runtime_fs_symlink()

bool runtime_fs_symlink ( const char *  src_path,
const char *  dest_path 
)

Definition at line 359 of file fs.cpp.

References runtime_fs_isdir().

Here is the call graph for this function:

◆ runtime_fs_temp_dir()

char * runtime_fs_temp_dir ( )

Definition at line 141 of file fs.cpp.