2.6.1.1 Creation and Removal¶
-
typedef uint32_t ZixCopyOptions¶
Bitwise OR of
ZixCopyOptionsvalues.
-
enum ZixCopyOption¶
Options to control filesystem copy operations.
-
enumerator ZIX_COPY_OPTION_NONE¶
Report any error.
-
enumerator ZIX_COPY_OPTION_OVERWRITE_EXISTING¶
Replace existing file.
-
enumerator ZIX_COPY_OPTION_NONE¶
-
ZixStatus zix_copy_file(ZixAllocator *allocator, const char *src, const char *dst, ZixCopyOptions options)¶
Copy the file at path
srcto pathdst.If supported by the system, a lightweight copy will be made to take advantage of copy-on-write support in the filesystem. Otherwise, a simple deep copy will be made.
- Parameters:
allocator – Allocator used for a memory block for copying if necessary.
src – Path to source file to copy.
dst – Path to destination file to create.
options – Options to control the kind of copy and error conditions.
- Returns:
ZixStatus.ZIX_STATUS_SUCCESSifdstwas successfully created, or an error.
-
ZixStatus zix_create_directories(ZixAllocator *allocator, const char *dir_path)¶
Create the directory
dir_pathand any parent directories if necessary.- Parameters:
allocator – Allocator used for a temporary path buffer if necessary.
dir_path – The path to the deepest directory to create.
- Returns:
ZixStatus.ZIX_STATUS_SUCCESSif all directories indir_pathwere successfully created (or already existed), or an error.
-
ZixStatus zix_create_directory(const char *dir_path)¶
Create the directory
dir_pathwith all available permissions.- Returns:
ZixStatus.ZIX_STATUS_SUCCESSifdir_pathwas successfully created, or an error.
-
ZixStatus zix_create_directory_like(const char *dir_path, const char *existing_path)¶
Create the directory
dir_pathwith the permissions of another.This is like
zix_create_directory(), but will copy the permissions from another directory.- Returns:
ZixStatus.ZIX_STATUS_SUCCESSifdir_pathwas successfully created, or an error.
-
ZixStatus zix_create_directory_symlink(const char *target_path, const char *link_path)¶
Create a symbolic link at path
linkthat points to the directorytarget.This is a separate function from
zix_create_symlink()because some systems (like Windows) require directory symlinks to be created specially.- Returns:
ZixStatus.ZIX_STATUS_SUCCESS, or an error.
-
ZixStatus zix_create_hard_link(const char *target_path, const char *link_path)¶
Create a hard link at path
linkthat points to pathtarget.- Returns:
ZixStatus.ZIX_STATUS_SUCCESS, or an error.
-
ZixStatus zix_create_symlink(const char *target_path, const char *link_path)¶
Create a symbolic link at path
linkthat points to pathtarget.Note that portable code should use
zix_create_directory_symlink()if the target is a directory, since this function won’t work for that on some systems (like Windows).- Returns:
ZixStatus.ZIX_STATUS_SUCCESS, or an error.
-
char *zix_create_temporary_directory(ZixAllocator *allocator, const char *path_pattern)¶
Create a unique temporary directory at a given path pattern.
The last six characters of
patternmust be “XXXXXX” and will be replaced with unique characters in the result.- Parameters:
allocator – Allocator used for the returned path.
path_pattern – A path pattern ending in “XXXXXX”.
- Returns:
The path of the created directory, or null.