2.6.1.1 Creation and Removal

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.

typedef uint32_t ZixCopyOptions

Bitwise OR of ZixCopyOptions values.

ZixStatus zix_copy_file(ZixAllocator *allocator, const char *src, const char *dst, ZixCopyOptions options)

Copy the file at path src to path dst.

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_SUCCESS if dst was successfully created, or an error.

ZixStatus zix_create_directory(const char *dir_path)

Create the directory dir_path with all available permissions.

Returns

ZixStatus.ZIX_STATUS_SUCCESS if dir_path was successfully created, or an error.

ZixStatus zix_create_directory_like(const char *dir_path, const char *existing_path)

Create the directory dir_path with the permissions of another.

This is like zix_create_directory(), but will copy the permissions from another directory.

Returns

ZixStatus.ZIX_STATUS_SUCCESS if dir_path was successfully created, or an error.

ZixStatus zix_create_directories(ZixAllocator *allocator, const char *dir_path)

Create the directory dir_path and 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_SUCCESS if all directories in dir_path were successfully created (or already existed), or an error.

Create a hard link at path link that points to path target.

Returns

ZixStatus.ZIX_STATUS_SUCCESS, or an error.

Create a symbolic link at path link that points to path target.

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.

Create a symbolic link at path link that points to the directory target.

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.

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 pattern must 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.

ZixStatus zix_remove(const char *path)

Remove the file or empty directory at path