LMMS
Loading...
Searching...
No Matches
filesystem.h File Reference
#include <stdbool.h>
#include <stdio.h>

Go to the source code of this file.

Functions

char * lilv_temp_directory_path (void)
 Return the path to a directory suitable for making temporary files.
bool lilv_path_is_absolute (const char *path)
 Return true iff path is an absolute path.
bool lilv_path_is_child (const char *path, const char *dir)
 Return true iff path is a child of dir.
char * lilv_path_current (void)
 Return the current working directory.
char * lilv_path_absolute (const char *path)
char * lilv_path_absolute_child (const char *path, const char *parent)
char * lilv_path_relative_to (const char *path, const char *base)
char * lilv_path_parent (const char *path)
char * lilv_path_filename (const char *path)
char * lilv_path_join (const char *a, const char *b)
 Join path a and path b with a single directory separator between them.
char * lilv_path_canonical (const char *path)
bool lilv_path_exists (const char *path)
 Return true iff path points to an existing file system entry.
bool lilv_is_directory (const char *path)
 Return true iff path points to an existing directory.
int lilv_copy_file (const char *src, const char *dst)
int lilv_symlink (const char *oldpath, const char *newpath)
int lilv_flock (FILE *file, bool lock, bool block)
void lilv_dir_for_each (const char *path, void *data, void(*f)(const char *path, const char *name, void *data))
char * lilv_create_temporary_directory_in (const char *pattern, const char *parent)
char * lilv_create_temporary_directory (const char *pattern)
int lilv_create_directories (const char *dir_path)
int lilv_remove (const char *path)
 Remove the file or empty directory at path.
bool lilv_file_equals (const char *a_path, const char *b_path)
 Return true iff the given paths point to files with identical contents.

Function Documentation

◆ lilv_copy_file()

int lilv_copy_file ( const char * src,
const char * dst )

Copy the file at path src to path dst.

Returns
Zero on success, or a standard errno error code.

◆ lilv_create_directories()

int lilv_create_directories ( const char * dir_path)

Create the directory dir_path and any parent directories if necessary.

Returns
Zero on success, or an errno error code.

◆ lilv_create_temporary_directory()

char * lilv_create_temporary_directory ( const char * pattern)

Create a unique temporary directory.

This is like lilv_create_temporary_directory_in(), except it creates the directory in the system temporary directory.

◆ lilv_create_temporary_directory_in()

char * lilv_create_temporary_directory_in ( const char * pattern,
const char * parent )

Create a unique temporary directory in a specific directory.

The last six characters of pattern must be XXXXXX and will be replaced with random characters. This works roughly like mkdtemp, except the pattern should only be a directory name, not a full path. The created path will be a child of the given parent directory.

◆ lilv_dir_for_each()

void lilv_dir_for_each ( const char * path,
void * data,
void(* )(const char *path, const char *name, void *data) )

Visit every file in the directory at path.

Parameters
pathA path to a directory.
dataOpaque user data that is passed to f.
fA function called on every entry in the directory. The path parameter is always the directory path passed to this function, the name parameter is the name of the directory entry (not its full path).

◆ lilv_file_equals()

bool lilv_file_equals ( const char * a_path,
const char * b_path )

Return true iff the given paths point to files with identical contents.

◆ lilv_flock()

int lilv_flock ( FILE * file,
bool lock,
bool block )

Set or remove an advisory exclusive lock on file.

If the lock is true and the file is already locked by another process, or by this process via a different file handle, then this will not succeed and non-zero will be returned.

Parameters
fileHandle for open file to lock.
lockTrue to set lock, false to release lock.
blockIf true, then this call will block until the lock is acquired.
Returns
Zero on success.

◆ lilv_is_directory()

bool lilv_is_directory ( const char * path)

Return true iff path points to an existing directory.

◆ lilv_path_absolute()

char * lilv_path_absolute ( const char * path)

Return path as an absolute path.

If path is absolute, an identical copy of it is returned. Otherwise, the returned path is relative to the current working directory.

◆ lilv_path_absolute_child()

char * lilv_path_absolute_child ( const char * path,
const char * parent )

Return path as an absolute path relative to parent.

If path is absolute, an identical copy of it is returned. Otherwise, the returned path is relative to parent.

◆ lilv_path_canonical()

char * lilv_path_canonical ( const char * path)

Return path as a canonicalized absolute path.

This expands all symbolic links, relative references, and removes extra directory separators.

◆ lilv_path_current()

char * lilv_path_current ( void )

Return the current working directory.

◆ lilv_path_exists()

bool lilv_path_exists ( const char * path)

Return true iff path points to an existing file system entry.

◆ lilv_path_filename()

char * lilv_path_filename ( const char * path)

Return the filename component of path without any directories.

Returns the empty string if path is the root path.

◆ lilv_path_is_absolute()

bool lilv_path_is_absolute ( const char * path)

Return true iff path is an absolute path.

◆ lilv_path_is_child()

bool lilv_path_is_child ( const char * path,
const char * dir )

Return true iff path is a child of dir.

◆ lilv_path_join()

char * lilv_path_join ( const char * a,
const char * b )

Join path a and path b with a single directory separator between them.

◆ lilv_path_parent()

char * lilv_path_parent ( const char * path)

Return the path to the directory that contains path.

Returns the root path if path is the root path.

◆ lilv_path_relative_to()

char * lilv_path_relative_to ( const char * path,
const char * base )

Return path relative to base if possible.

If path is not within base, a copy is returned. Otherwise, an equivalent path relative to base is returned (which may contain up-references).

◆ lilv_remove()

int lilv_remove ( const char * path)

Remove the file or empty directory at path.

◆ lilv_symlink()

int lilv_symlink ( const char * oldpath,
const char * newpath )

Create a symlink at newpath that points to oldpath.

Returns
Zero on success, otherwise non-zero and errno is set.

◆ lilv_temp_directory_path()

char * lilv_temp_directory_path ( void )

Return the path to a directory suitable for making temporary files.