Filesystem API

Filesystem utilities.

Namespaces

Classes

BLFile API Constants

BLFile C API Functions

File read/write functionality is provided by BLFileCore in C API and wrapped by BLFile in C++ API.

Enumeration Type Documentation

BLFileOpenFlags : uint32_tenum◆ 

File open flags, see BLFile::open().

ConstantDescription
BL_FILE_OPEN_NO_FLAGS 

No flags.

BL_FILE_OPEN_READ 

Opens the file for reading.

The following system flags are used when opening the file:

  • O_RDONLY (Posix)
  • GENERIC_READ (Windows)
BL_FILE_OPEN_WRITE 

Opens the file for writing:

The following system flags are used when opening the file:

  • O_WRONLY (Posix)
  • GENERIC_WRITE (Windows)
BL_FILE_OPEN_RW 

Opens the file for reading & writing.

The following system flags are used when opening the file:

  • O_RDWR (Posix)
  • GENERIC_READ | GENERIC_WRITE (Windows)
BL_FILE_OPEN_CREATE 

Creates the file if it doesn't exist or opens it if it does.

The following system flags are used when opening the file:

  • O_CREAT (Posix)
  • CREATE_ALWAYS or OPEN_ALWAYS depending on other flags (Windows)
BL_FILE_OPEN_DELETE 

Opens the file for deleting or renaming (Windows).

Adds DELETE flag when opening the file to ACCESS_MASK.

BL_FILE_OPEN_TRUNCATE 

Truncates the file.

The following system flags are used when opening the file:

  • O_TRUNC (Posix)
  • TRUNCATE_EXISTING (Windows)
BL_FILE_OPEN_READ_EXCLUSIVE 

Opens the file for reading in exclusive mode (Windows).

Exclusive mode means to not specify the FILE_SHARE_READ option.

BL_FILE_OPEN_WRITE_EXCLUSIVE 

Opens the file for writing in exclusive mode (Windows).

Exclusive mode means to not specify the FILE_SHARE_WRITE option.

BL_FILE_OPEN_RW_EXCLUSIVE 

Opens the file for both reading and writing (Windows).

This is a combination of both BL_FILE_OPEN_READ_EXCLUSIVE and BL_FILE_OPEN_WRITE_EXCLUSIVE.

BL_FILE_OPEN_CREATE_EXCLUSIVE 

Creates the file in exclusive mode - fails if the file already exists.

The following system flags are used when opening the file:

  • O_EXCL (Posix)
  • CREATE_NEW (Windows)
BL_FILE_OPEN_DELETE_EXCLUSIVE 

Opens the file for deleting or renaming in exclusive mode (Windows).

Exclusive mode means to not specify the FILE_SHARE_DELETE option.

BLFileSeekType : uint32_tenum◆ 

File seek mode, see BLFile::seek().

Note
Seek constants should be compatible with constants used by both POSIX and Windows API.
ConstantDescription
BL_FILE_SEEK_SET 

Seek from the beginning of the file (SEEK_SET).

BL_FILE_SEEK_CUR 

Seek from the current position (SEEK_CUR).

BL_FILE_SEEK_END 

Seek from the end of the file (SEEK_END).

BL_FILE_SEEK_MAX_VALUE 

Maximum value of BLFileSeekType.

BLFileReadFlags : uint32_tenum◆ 

File read flags used by BLFileSystem::readFile().

ConstantDescription
BL_FILE_READ_NO_FLAGS 

No flags.

BL_FILE_READ_MMAP_ENABLED 

Use memory mapping to read the content of the file.

The destination buffer BLArray<> would be configured to use the memory mapped buffer instead of allocating its own.

BL_FILE_READ_MMAP_AVOID_SMALL 

Avoid memory mapping of small files.

The size of small file is determined by Blend2D, however, you should expect it to be 16kB or 64kB depending on host operating system.

BL_FILE_READ_MMAP_NO_FALLBACK 

Do not fallback to regular read if memory mapping fails. It's worth noting that memory mapping would fail for files stored on filesystem that is not local (like a mounted network filesystem, etc...).