N64FlashcartMenu
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fs.h File Reference

File system utility functions. More...

Go to the source code of this file.

Macros

#define FS_SECTOR_SIZE   (512)
 

Functions

char * strip_fs_prefix (char *path)
 Strips the file system prefix from the given path.
 
char * file_basename (char *path)
 Gets the basename of the given path.
 
bool file_exists (char *path)
 Checks if a file exists at the given path.
 
int64_t file_get_size (char *path)
 Gets the size of the file at the given path.
 
bool file_allocate (char *path, size_t size)
 Allocates a file of the specified size at the given path.
 
bool file_fill (char *path, uint8_t value)
 Fills a file with the specified value.
 
bool file_has_extensions (char *path, const char *extensions[])
 Checks if a file has one of the specified extensions.
 
bool directory_exists (char *path)
 Checks if a directory exists at the given path.
 
bool directory_create (char *path)
 Creates a directory at the given path.
 

Detailed Description

File system utility functions.

Function Documentation

◆ strip_fs_prefix()

char * strip_fs_prefix ( char * path)

Strips the file system prefix from the given path.

This function removes the file system prefix from the provided path.

Parameters
pathThe path from which to strip the prefix.
Returns
A pointer to the path without the prefix.

◆ file_basename()

char * file_basename ( char * path)

Gets the basename of the given path.

This function returns the basename of the provided path.

Parameters
pathThe path from which to get the basename.
Returns
A pointer to the basename of the path.

◆ file_exists()

bool file_exists ( char * path)

Checks if a file exists at the given path.

This function checks if a file exists at the specified path.

Parameters
pathThe path to the file.
Returns
true if the file exists, false otherwise.

◆ file_get_size()

int64_t file_get_size ( char * path)

Gets the size of the file at the given path.

This function returns the size of the file at the specified path.

Parameters
pathThe path to the file.
Returns
The size of the file in bytes, or -1 if the file does not exist.

◆ file_allocate()

bool file_allocate ( char * path,
size_t size )

Allocates a file of the specified size at the given path.

This function creates a file of the specified size at the provided path.

Parameters
pathThe path to the file.
sizeThe size of the file to create.
Returns
true if the file was successfully created, false otherwise.

◆ file_fill()

bool file_fill ( char * path,
uint8_t value )

Fills a file with the specified value.

This function fills the file at the given path with the specified value.

Parameters
pathThe path to the file.
valueThe value to fill the file with.
Returns
true if the file was successfully filled, false otherwise.

◆ file_has_extensions()

bool file_has_extensions ( char * path,
const char * extensions[] )

Checks if a file has one of the specified extensions.

This function checks if the file at the given path has one of the specified extensions.

Parameters
pathThe path to the file.
extensionsAn array of extensions to check.
Returns
true if the file has one of the specified extensions, false otherwise.

◆ directory_exists()

bool directory_exists ( char * path)

Checks if a directory exists at the given path.

This function checks if a directory exists at the specified path.

Parameters
pathThe path to the directory.
Returns
true if the directory exists, false otherwise.

◆ directory_create()

bool directory_create ( char * path)

Creates a directory at the given path.

This function creates a directory at the specified path.

Parameters
pathThe path to the directory.
Returns
true if the directory was successfully created, false otherwise.