These functions/structures/types are used to perform actions that typically don’t have shared functions across different operating systems and platforms.
#include <util/platform.h>
Opens a file with a wide string path.
Opens a file with a UTF8 string path.
Returns a file’s size.
Equivalent to the posix stat function.
Equivalent to fseek.
Gets the current file position.
Reads a UTF8 encoded file and allocates a pointer to the UTF8 string.
Reads a UTF8 encoded file and returns an allocated pointer to the string.
Writes a UTF8 encoded file.
Writes a UTF8 encoded file with overwrite corruption prevention.
Gets a file’s size.
Gets free space of a specific file path.
Converts a UTF8 string to a wide string.
Converts a wide string to a UTF8 string.
Gets an bmalloc-allocated wide string converted from a UTF8 string.
Gets an bmalloc-allocated UTF8 string converted from a wide string.
Converts a string to a double.
Converts a double to a string.
These functions are roughly equivalent to dlopen/dlsym/dlclose.
Opens a dynamic library.
Returns a symbol from a dynamic library.
Closes a dynamic library.
Returns true if the path is a dynamic library that looks like an OBS plugin.
Currently only needed on Windows for performance reasons.
Creates a CPU usage information object.
Queries the current CPU usage.
Destroys a CPU usage information object.
Sleeps to a specific time with high precision, in nanoseconds.
Sleeps to a specific time without high precision, in nanoseconds. The function won’t return until reaching the specific time.
Sleeps for a specific number of milliseconds.
Gets the current high-precision system time, in nanoseconds.
Gets the user-specific application configuration data path.
Gets the application configuration data path.
Returns true if a file/directory exists, false otherwise.
Converts a relative path to an absolute path.
Returns the extension portion of a path string, including the dot (.).
A directory object.
A directory entry record.
Opens a directory object to enumerate files within the directory.
A glob entry.
The full path to the glob entry.
true if the glob entry is a directory, false otherwise.
A glob object.
Number of glob entries.
Array of glob entries.
Enumerates files based upon a glob string.
Deletes a file.
Deletes a directory.
Returns a new bmalloc-allocated path to the current working directory.
Changes the current working directory.
Creates a directory.
Creates a full directory path if it doesn’t exist.
Renames a file.
Copies a file.
Safely replaces a file.
Returns a new bmalloc-allocated filename generated from specific formatting.
These functions/types are used to inhibit the computer from going to sleep.
Creates a sleep inhibition object.
Activates/deactivates a sleep inhibition object.
Destroys a sleep inhibition object. If the sleep inhibition object was active, it will be deactivated.
Triggers a debugger breakpoint (or crashes the program if no debugger present).
Returns the number of physical cores available.
Returns the number of logical cores available.
Returns the amount of memory available.
Returns the amount of memory installed.
Added in version 29.0.0.
Memory usage structure.
Resident size.
Virtual size.
Gets memory usage of the current process.
Returns the resident memory size of the current process.
Returns the virtual memory size of the current process.
Returns true if the current process is an x64 binary and is being emulated or translated by the host operating system. On macOS, it returns true when an x64 binary is being translated by Rosetta and running on Apple Silicon Macs. On Windows, it returns true when an x64 binary is being emulated on Windows ARM64 PCs. On all other platforms, it will always returns false.