Global file system manager. More...
Classes | |
struct | Queue_t |
Asynchronous file I/O message. More... | |
Public Types | |
enum | ePrefix { kPrefixCurrent = 8 , kPrefixApplication = 9 , kPrefixBoot = 32 , kPrefixPrefs = 33 , kPrefixSystem = 34 , kPrefixCount = 35 , kPrefixInvalid = 999 } |
Predefined pathname prefixes. More... | |
enum | eIOCommand { kIOCommandInvalid , kIOCommandOpen , kIOCommandClose , kIOCommandRead , kIOCommandWrite , kIOCommandSeek , kIOCommandSeekEOF , kIOCommandCallback , kIOCommandSync , kIOCommandEndThread } |
Asynchronous file I/O commands. More... | |
typedef void(*) | ProcCallback(Queue_t *pQueue) |
Function prototype for asynchronous I/O callbacks. | |
Public Member Functions | |
void | flush_IO (void) noexcept |
Clear out pending events. | |
void | wait_until_queue_has_space (void) noexcept |
Test if there is space in the queue. | |
void | add_queue (File *pFile, eIOCommand uIOCommand, void *pBuffer, uintptr_t uLength) noexcept |
Add a file event into the queue. | |
void | sync (File *pFile) noexcept |
Wait until all pending file calls are processed. | |
Static Public Member Functions | |
static uintptr_t | queue_handler (void *pData) noexcept |
Queue thread. | |
static eError | initialize (void) noexcept |
Initialize the global file system manager. | |
static void | shut_down (void) noexcept |
Shut down the global file system manager. | |
static uint_t | MSDOS_has_long_filenames (void) noexcept |
Returns TRUE if long filenames are allowed. | |
static uint_t | MSDOS_get_os_version (void) noexcept |
Returns SETVER version of MS/DOS. | |
static uint_t | MSDOS_get_os_true_version (void) noexcept |
Returns SETVER version of MS/DOS. | |
static const char * | MSDOS_get_name (void) noexcept |
Returns the name of the version of DOS running. | |
static uint_t | MSDOS_get_flavor (void) noexcept |
Returns the OEM flavor of MS/DOS. | |
static eError | MSDOS_expand_8_3_filename (String *pInput) noexcept |
Convert 8.3 MSDos filename to long version. | |
static eError | MSDOS_convert_to_8_3_filename (String *pInput) noexcept |
Convert long filename to an MSDos 8.3 filename. | |
static uint_t | is_UTF8_file_system (void) noexcept |
Test if the file system supports UTF8 pathnames. | |
static eError | get_volume_name (Filename *pOutput, uint_t uVolumeNum) noexcept |
Return the name of a drive. | |
static uint_t | get_volume_number (const char *pInput) noexcept |
Given a volume name, return the volume number it's mounted on. | |
static eError | set_default_prefixes (void) noexcept |
Set the initial default prefixes for a power up state. | |
static eError | get_prefix (Filename *pOutput, uint_t uPrefixNum) noexcept |
Return the contents of a prefix. | |
static eError | get_prefix (String *pOutput, uint_t uPrefixNum) noexcept |
Return the contents of a prefix. | |
static eError | set_prefix (uint_t uPrefixNum, const char *pPrefixName) noexcept |
Set the contents of a prefix. | |
static eError | set_prefix (uint_t uPrefixNum, const Filename *pPrefixName) noexcept |
Set the contents of a prefix with a filename. | |
static eError | pop_prefix (uint_t uPrefixNum) noexcept |
Remove the last entry of a prefix. | |
static eError | get_modification_time (const char *pFileName, TimeDate_t *pOutput) noexcept |
Get a file's last modification time. | |
static eError | get_modification_time (Filename *pFileName, TimeDate_t *pOutput) noexcept |
Get a file's last modification time. | |
static eError | get_creation_time (const char *pFileName, TimeDate_t *pOutput) noexcept |
Get a file's creation time. | |
static eError | get_creation_time (Filename *pFileName, TimeDate_t *pOutput) noexcept |
Get a file's creation time. | |
static uint_t | does_file_exist (const char *pFileName) noexcept |
Detect for a file's existence. | |
static uint_t | does_file_exist (Filename *pFileName) noexcept |
Detect for a file's existence using a native pathname. | |
static uint32_t | get_creator_type (const char *pFileName) |
Return a file's creator code. | |
static uint32_t | get_creator_type (Filename *pFileName) |
Return a file's type code using a native filename. | |
static uint32_t | get_file_type (const char *pFileName) |
Return a file's type code. | |
static uint32_t | get_file_type (Filename *pFileName) |
Return a file's creator code using a native filename. | |
static eError | get_creator_and_file_type (const char *pFileName, uint32_t *pCreatorType, uint32_t *pFileType) |
Return a file's type and creator codes. | |
static eError | get_creator_and_file_type (Filename *pFileName, uint32_t *pCreatorType, uint32_t *pFileType) |
Return a file's type and creator codes using a native filename. | |
static eError | set_creator_type (const char *pFileName, uint32_t uCreatorType) |
Set a file's creator code. | |
static eError | set_creator_type (Filename *pFileName, uint32_t uCreatorType) |
Set a file's type code using a native filename. | |
static eError | set_file_type (const char *pFileName, uint32_t uFileType) |
Set a file's type code. | |
static eError | set_file_type (Filename *pFileName, uint32_t uFileType) |
Set a file's type code using a native filename. | |
static eError | set_creator_and_file_type (const char *pFileName, uint32_t uCreatorType, uint32_t uFileType) |
Set a file's type and creator codes. | |
static eError | set_creator_and_file_type (Filename *pFileName, uint32_t uCreatorType, uint32_t uFileType) |
Set a file's type and creator codes using a native filename. | |
static eError | create_directory_path (const char *pFileName) noexcept |
Create a directory path. | |
static eError | create_directory_path (Filename *pFileName) noexcept |
Create a directory path. | |
static eError | create_directory_path_dirname (const char *pFileName) |
Create a directory path sans the last filename token. | |
static eError | create_directory_path_dirname (const Filename *pFileName) |
Create a directory path sans the last filename token. | |
static eError | delete_file (const char *pFileName) noexcept |
Delete a file or empty directory. | |
static eError | delete_file (Filename *pFileName) noexcept |
Delete a file or empty directory using a Filename. | |
static eError | rename_file (const char *pNewName, const char *pOldName) noexcept |
Rename a file. | |
static eError | rename_file (Filename *pNewName, Filename *pOldName) noexcept |
Rename a file using Filename. | |
static eError | change_OS_directory (const char *pDirName) |
Change the OS working directory. | |
static eError | change_OS_directory (Filename *pDirName) |
Change the OS working directory using an OS native pathname.. | |
static FILE * | open_file (const char *pFileName, const char *pType) noexcept |
Open a file using stdio. | |
static FILE * | open_file (Filename *pFileName, const char *pType) noexcept |
Open a file using stdio. | |
static eError | copy_file (const char *pDestName, const char *pSourceName) noexcept |
Copy a file. | |
static eError | copy_file (Filename *pDestName, Filename *pSourceName) noexcept |
Copy a file using OS native pathnames. | |
static eError | save_file (const char *pFileName, const void *pData, uintptr_t uLength) noexcept |
Save a file. | |
static eError | save_file (Filename *pFileName, const void *pData, uintptr_t uLength) noexcept |
Save a file using an OS native pathname. | |
static eError | save_text_file (const char *pFileName, const void *pData, uintptr_t uLength) noexcept |
Save a text file. | |
static eError | save_text_file (Filename *pFileName, const void *pData, uintptr_t uLength) noexcept |
Save a text file using a Filename. | |
static void * | load_file (const char *pFileName, uintptr_t *pLength) noexcept |
Load a file into memory. | |
static void * | load_file (Filename *pFileName, uintptr_t *pLength) noexcept |
Load a file into memory using a Filename. | |
static const char * | get_boot_name (void) noexcept |
Return the boot volume name. | |
static uintptr_t | get_boot_name_length (void) noexcept |
Return the length of the boot volume name. | |
static const String * | get_volume_prefix (void) noexcept |
Access the volume prefix string. | |
static short | OpenResourceFile (const char *pFileName, char uPermission) |
Open a MacOS resource fork. | |
static uint_t | CreateResourceFIle (const char *pFileName) |
Create a Mac OS resource fork. | |
static const char * | UnixFindProcFolder (void) noexcept |
Find the location of /proc. | |
static void | UnixFind_etc_mtab (String &rOutput, const char *pProcPath) noexcept |
Find the location of /etc/mtab. | |
static void | UnixParseFSTypes (ClassArray< String > &rFSTypes, const char *pProcPath) noexcept |
Create the list of file system types. | |
static void | UnixParseFStab (ClassArray< String > &rFSTabs) noexcept |
Create the list of mounted volumes. | |
static void | UnixParseMTab (ClassArray< String > &rVolumePaths, const char *pEtcMtab, const ClassArray< String > &rFSTypes) noexcept |
Create the list of mounted volumes. | |
static void | unix_find_volumes_folder (String *pOutput) noexcept |
Find the folder the has the mounted volumes. | |
Static Public Attributes | |
static const uint_t | kMaxQueue = 128 |
Maximum number of pending IO events(Power of 2) | |
static FileManager * | g_pFileManager |
Global instance of the file manager. | |
Protected Member Functions | |
FileManager () noexcept | |
Construct the file manager. | |
~FileManager () | |
Destroy the file manager. | |
void | platform_setup (void) noexcept |
Handle platform specific startup code. | |
void | platform_shutdown (void) noexcept |
Handle platform specific shutdown code. | |
Protected Attributes | |
Semaphore | m_PingIOThread |
Semaphore to ping the IO thread. | |
Semaphore | m_IOThreadSync |
Semaphore to get a reply from the IO thread for syncing. | |
Thread | m_Thread |
Worker thread record pointer. | |
volatile uint32_t | m_uQueueStart |
Index to the queue start. | |
volatile uint32_t | m_uQueueEnd |
Index to the end of the queue. | |
String | m_Prefixes [kPrefixCount] |
Array of prefix strings. | |
Queue_t | m_IOQueue [kMaxQueue] |
Queue of IO events. | |
const char * | m_pDOSName |
Name of the MSDos flavor being run. | |
uint16_t | m_uMSDOSVersion |
MSDOS version (MSDOS Only) | |
uint16_t | m_uMSDOSTrueVersion |
MSDOS TRUE version (MSDOS Only) | |
uint8_t | m_bLongNamesAllowed |
True if MSDOS has long filename support (MSDOS Only) | |
uint8_t | m_uOEMFlavor |
OEM number (MSDOS Only) | |
uintptr_t | m_uBootNameSize |
Length of the boot volume name (Darwin only) | |
char * | m_pBootName |
Boot volume name in the format ":FooBar" (Zero terminated) (Darwin only) | |
String | m_ProcPath |
Pointer to the /proc pathname or nullptr is no permission exists to access it. | |
String | m_EtcMtab |
Pointer to the /etc/mtab file. | |
String | m_VolumePrefix |
Volume prefix for paths. | |
ClassArray< String > | m_FSTypes |
Array of strings of file system types. | |
ClassArray< String > | m_FSTabs |
Array of strings from fstab. | |
ClassArray< String > | m_VolumePaths |
Array of string of mounted volume paths. | |
Private Member Functions | |
FileManager (const FileManager &)=delete | |
FileManager & | operator= (const FileManager &)=delete |
FileManager (FileManager &&)=delete | |
FileManager & | operator= (FileManager &&)=delete |
Global file system manager.
Since file systems are all tied to a single device such as a hard drive or CD/DVD/Blu-Ray, all file calls are routed through a singleton class to enable Burgerlib to prioritize file streaming to reduce seeks and read/write operations for peak performance.
To ensure cross platform compatibility, all file/pathnames use a generic universal format that BurgerLib will accept and the library will perform any translations needed to the exact same behavior is consistent across operating systems.
The strings are "C" format, UTF8 with a zero termination byte. Colons are used at filename delimiters.
The concept of a BurgerLib path is simple. The first part is either a drive specifier, a volume name or a directory prefix. Drive specifiers act much like "C:" does on Windows machines. Volume names allow you to ask for a CD or DVD by name and query if it is mounted regardless of which drive it physically resides. Prefixes act like current working directories except that there are over 30 of them active at the same time and with a numeric or special character code you can quickly select the desired one at runtime.
Some prefixes are preset after a call to set_default_prefixes().
Default prefixes:
Example pathnames:
void( *) Burger::FileManager::ProcCallback(Queue_t *pQueue) |
Function prototype for asynchronous I/O callbacks.
Asynchronous file I/O commands.
These are the commands for the file event queue to perform file operations in the background.
Predefined pathname prefixes.
Enumerations for all of the built-in prefixes that are outside the bounds of prefixes 0-31
|
privatedelete |
|
privatedelete |
|
protectednoexcept |
Construct the file manager.
Guaranteed to construct without errors.
|
protected |
Destroy the file manager.
|
noexcept |
Add a file event into the queue.
If the queue is full, wait until there is room and then insert the command into the queue.
The data buffer must exist until after the async event occurs.
|
static |
Change the OS working directory.
Given a BurgerLib pathname, set the OS's current working directory to this path.
This function is useful in cases where an OS native file dialog to select a file or perform an OS native function where the current working directory needs to be preset. This function under most circumstances is not necessary to use, however, it exists since there are some OS native functions in MacOS and Windows that require a little "help".
pDirName | Pointer to a "C" string of a BurgerLib path. |
|
static |
Change the OS working directory using an OS native pathname..
Given an OS native pathname, set the OS's current working directory to this path.
This function is useful in cases where an OS native file dialog to select a file or perform an OS native function where the current working directory needs to be preset. This function under most circumstances is not necessary to use, however, it exists since there are some OS native functions in MacOS and Windows that require a little "help".
pDirName | Pointer to a Filename of a native OS path. |
|
staticnoexcept |
Copy a file.
Given a BurgerLib formatted old pathname and new pathname, make a duplicate of the file at the end of the pathname.
pDestName | Pointer to a "C" string of a BurgerLib path for the new name. |
pSrcName | Pointer to a "C" string of a BurgerLib path for the current file name. |
|
staticnoexcept |
Copy a file using OS native pathnames.
Given an OS native formatted old pathname and new pathname, make a duplicate of the file at the end of the pathname.
pDestName | Pointer to a Filename of an OS native path for the new name. |
pSourceName | Pointer to a Filename of an OS native path for the current file name. |
|
staticnoexcept |
Create a directory path.
Given a BurgerLib directory, create each and every part of the directory. If the directory already exists, or is successfully created, the call is considered successful.
Example:
If the path :Foo:Bar: exists, a call with ":Foo:Bar:Fooey:Temp:" will create both "Fooey" and "Temp" in this single call.
pFileName | Pointer to a "C" string of a BurgerLib path. |
|
staticnoexcept |
Create a directory path.
Given an Burgerlib directory, create each and every part of the directory. If the directory already exists, or is successfully created, the call is considered successful.
Example:
If the path c:\Foo\Bar exists, a call with "c:\Foo\Bar\Fooey\Temp\" will create both "Fooey" and "Temp" in this single call.
pFileName | Pointer to a Filename that contains a Burgerlib pathname. |
|
static |
Create a directory path sans the last filename token.
Given a BurgerLib directory, create each and every part of the directory from a path that includes a filename. If the directory already exists, or is successfully created, the call is considered successful.
Example:
If the path :Foo:Bar: exists, a call with ":Foo:Bar:Fooey:Temp:File.txt" will create both "Fooey" and "Temp" in this single call. The last token of "File.txt" is ignored.
pFileName | Pointer to a "C" string of a BurgerLib path. |
|
static |
Create a directory path sans the last filename token.
Given a BurgerLib directory, create each and every part of the directory from a path that includes a filename. If the directory already exists, or is successfully created, the call is considered successful.
Example:
If the path :Foo:Bar: exists, a call with ":Foo:Bar:Fooey:Temp:File.txt" will create both "Fooey" and "Temp" in this single call. The last token of "File.txt" is ignored.
pFileName | Pointer to a Filename class |
|
static |
Create a Mac OS resource fork.
This will use a generic pathname and creates a Macintosh resource file with a call to HCreateResFile().
pFileName | Pointer to a Burgerlib file name |
|
staticnoexcept |
Delete a file or empty directory.
Given a BurgerLib pathname, delete the file at the end of the pathname.
Example:
If a call with ":Foo:Bar:Fooey:Temp.txt" is issued, only the file "Temp.txt" is deleted. The rest of the path is left intact. This call will not delete non-empty directories, only files. If the file is already deleted, an error is returned.
pFileName | Pointer to a "C" string of a BurgerLib path. |
|
staticnoexcept |
Delete a file or empty directory using a Filename.
Given an OS native pathname, delete the file at the end of the pathname.
Example:
If a call with "c:\Foo\Bar\Fooey\Temp.txt" is issued, only the file "Temp.txt" is deleted. The rest of the path is left intact. This call will not delete non-empty directories, only files. If the file is already deleted, an error is returned.
pFileName | Pointer to a Filename of a Burgerlib path. |
|
staticnoexcept |
Detect for a file's existence.
Given a BurgerLib pathname, return TRUE if the file exists. FALSE if there is an disk error or the file does not exist.
pFileName | Pointer to a "C" string of a BurgerLib pathname, |
|
staticnoexcept |
Detect for a file's existence using a native pathname.
Given a OS native pathname, return TRUE if the file exists. FALSE if there is an disk error or the file does not exist.
pFileName | Pointer to a Filename which contains a native version of the path to the file. |
|
noexcept |
Clear out pending events.
Clear out the I/O file queue. All events with callbacks will return a cancel error.
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
staticnoexcept |
Get a file's creation time.
Given a BurgerLib path, access the file and return the time/date that it was created.
pFileName | Pointer to a "C" string to a BurgerLib pathname |
pOutput | Pointer to an uninitialized TimeDate_t structure that will receive the time/date. |
|
staticnoexcept |
Get a file's creation time.
Given a native operating system path, access the file and return the time/date that it was created.
pFileName | Pointer to a Filename class that is properly initialized to the native file system. |
pOutput | Pointer to an uninitialized TimeDate_t structure that will receive the time/date. |
|
static |
Return a file's type and creator codes.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename, and the creator code of the application that owns this file. This function will retrieve the 4 byte codes from the file.
On non MacOS platforms, this function only return non-zero (An error condition) and perform store zeros in the result values..
pFileName | Pointer to a "C" string of a BurgerLib pathname |
pCreatorType | Pointer to a uint32_t that will receive the file creator code. |
pFileType | Pointer to a uint32_t that will receive the file type code. |
|
static |
Return a file's type and creator codes using a native filename.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename, and the creator code of the application that owns this file. This function will retrieve the 4 byte codes from the file.
On non MacOS platforms, this function only return non-zero (An error condition) and perform store zeros in the result values..
pFileName | Pointer to a Filename of a native OS pathname |
pCreatorType | Pointer to a uint32_t that will receive the file creator code. |
pFileType | Pointer to a uint32_t that will receive the file type code. |
|
static |
Return a file's creator code.
On MacOS, a file has extended data which includes the application code that owns the file. This function will retrieve the 4 byte code from the file.
On non MacOS platforms, this function only return 0 (An error condition) and perform nothing.
pFileName | Pointer to a "C" string of a BurgerLib pathname |
|
static |
Return a file's type code using a native filename.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename. This function will retrieve the 4 byte code from the file.
On non MacOS platforms, this function only return 0 (An error condition) and perform nothing.
pFileName | Pointer to a Filename of a native OS pathname |
|
static |
Return a file's type code.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename. This function will retrieve the 4 byte code from the file.
On non MacOS platforms, this function only return 0 (An error condition) and perform nothing..
pFileName | Pointer to a "C" string of a BurgerLib pathname |
|
static |
Return a file's creator code using a native filename.
On MacOS, a file has extended data which includes the application code that owns the file. This function will retrieve the 4 byte code from the file.
On non MacOS platforms, this function only return 0 (An error condition) and perform nothing..
pFileName | Pointer to a Filename of a native OS pathname |
|
staticnoexcept |
Get a file's last modification time.
Given a BurgerLib path, access the file and return the time/date that it was last modified.
pFileName | Pointer to a "C" string to a BurgerLib pathname |
pOutput | Pointer to an uninitialized TimeDate_t structure that will receive the time/date. |
|
staticnoexcept |
Get a file's last modification time.
Given a native operating system path, access the file and return the time/date that it was last modified.
pFileName | Pointer to a Filename class that is properly initialized to the native file system. |
pOutput | Pointer to an uninitialized TimeDate_t structure that will receive the time/date. |
|
staticnoexcept |
Return the contents of a prefix.
Given a prefix number, fill in a Filename structure with a copy of the prefix pathname. The string could be an empty string in the case of an unused or nullptr prefix.
pOutput | Pointer to a Filename class to store the string |
uPrefixNum | Index to the requested prefix to obtain |
|
staticnoexcept |
Return the contents of a prefix.
Given a prefix number, fill in a String structure with a copy of the prefix pathname. The string could be an empty string in the case of an unused or nullptr prefix.
pOutput | Pointer to a String class to store the string |
uPrefixNum | Index to the requested prefix to obtain |
|
staticnoexcept |
Return the name of a drive.
Given a drive number (0-?), return the name of the volume in the format of ":Volume name:". The function will guarantee the existence of the colons.
pOutput | A Filename structure to contain the filename (Can be nullptr ) |
uVolumeNum | A valid drive number from 0-?? with ?? being the maximum number of drives in the system |
|
staticnoexcept |
Given a volume name, return the volume number it's mounted on.
Scanning all the disk volumes, search for a drive that is labeled by the input name. The input is in the form of ":home:". The search is case insensitive.
pVolumeName | Valid pointer to "C" string in the form of ":name:" |
|
inlinestaticnoexcept |
Access the volume prefix string.
Unix like operating systems can't agree on the name of the mount point for all mounted block devices. This function will return the prefix for the pathname for a mount point.
|
staticnoexcept |
Initialize the global file system manager.
Call this function once on startup to start up the Burgerlib file manager. This function's primary purpose is to initialize the default prefixes.
|
staticnoexcept |
Test if the file system supports UTF8 pathnames.
Returns TRUE if the filesystem has native Unicode filenames. On legacy or some game consoles, only the ASCII character set is supported.
Mac OS classic is special because if the application is running under MacOS 8.1 or higher, Unicode is supported, if it's earlier, only character codes that exist in Mac Roman US are used.
|
staticnoexcept |
Load a file into memory.
Given a BurgerLib pathname, open the file, allocate a buffer for it, load it into memory and return the pointer to the allocated buffer and the optional buffer size.
This function is a quick and easy way to read the contents of a file into a buffer. The buffer must be deleted with a call to Burger::Free( const void*)
pFileName | Pointer to a "C" string of a BurgerLib path. |
pLength | Pointer to a uintptr_t to receive the size of the buffer. |
|
staticnoexcept |
Load a file into memory using a Filename.
Given an OS native pathname, open the file, allocate a buffer for it, load it into memory and return the pointer to the allocated buffer and the optional buffer size.
This function is a quick and easy way to read the contents of a file into a buffer. The buffer must be deleted with a call to Burger::Free( const void *)
pFileName | Pointer to a Filename object. |
pLength | Pointer to a uintptr_t to receive the size of the buffer. |
|
staticnoexcept |
Convert long filename to an MSDos 8.3 filename.
On versions of MS/DOS that supports long filenames, convert an input long filename into its 8.3 filename counterpart if possible. If the operating system does not support long filenames, nothing is done to the input string.
pInput | Pointer to String with the long filename in MS/DOS format |
|
staticnoexcept |
Convert 8.3 MSDos filename to long version.
On versions of MS/DOS that supports long filenames, convert an input 8.3 filename into its long filename counterpart if possible. If the operating system does not support long filenames, nothing is done to the input string.
pInput | Pointer to String with the 8.3 filename in MS/DOS format |
|
staticnoexcept |
Returns the OEM flavor of MS/DOS.
Returns the OEM flavor value for MS/DOS to determine the vendor of the version of the OS running.
|
staticnoexcept |
Returns the name of the version of DOS running.
Returns a string with the name of the type of MS/DOS running. DOSBox is detected and reported as DOSBox
.
Example strings:
|
staticnoexcept |
Returns SETVER version of MS/DOS.
Returns the real version of MS/DOS. This cannot be overridden by the command SETVER.
|
staticnoexcept |
Returns SETVER version of MS/DOS.
Returns the version of MS/DOS. This can be overridden by the command SETVER for compatibility. Use the function MSDOS_get_os_true_version() to get the true version.
|
staticnoexcept |
Returns TRUE if long filenames are allowed.
On most MSDOS file systems, only 8.3 filenames are permitted. Test if support for longer than 8.3 filenames is present and if so, return TRUE, otherwise return FALSE.
|
staticnoexcept |
Open a file using stdio.
Given a BurgerLib pathname, open a file as if fopen() supported BurgerLib pathnames,
This is a cross platform method for opening a standard "C" library file stream. As such, this pointer must eventually be closed with a call to fclose().
The second parameter is passed as is to a subsequent call to fopen(). See the docs on fopen() on valid input such as "rb" for read binary and "w" for write text file.
pFileName | Pointer to a "C" string of a BurgerLib path. |
pType | Pointer to a "C" string that will be passed to a call to fopen(). |
|
staticnoexcept |
Open a file using stdio.
Given a BurgerLib pathname, open a file as if fopen() supported BurgerLib pathnames.
This is a cross platform method for opening a standard "C" library file stream. As such, this pointer must eventually be closed with a call to fclose().
The second parameter is passed as is to a subsequent call to fopen(). See the docs on fopen() on valid input such as "rb" for read binary and "w" for write text file.
pFileName | Pointer to a "C" string of a BurgerLib path. |
pType | Pointer to a "C" string that will be passed to a call to fopen(). |
|
static |
Open a MacOS resource fork.
Using a Burgerlib pathname, open a resource fork of the requested MacOS file using a call to HOpenResFile().
pFileName | Pointer to a Burgerlib file name |
uPermission | Permission value passed to HOpenResFile() |
|
privatedelete |
|
privatedelete |
|
protectednoexcept |
Handle platform specific startup code.
Calls system functions to determine the version, state and several platform specific variables to allow the FileManager to run better by pre-caching relevant data.
For MS-DOS, it will determine the version and flavor of MS/DOS this application is running. It will also detect DosBox.
For Linux, it will scan all the mounted volumes for quick access to shared volumes.
For Android and consoles, it will check if there are mounted SD Cards or other external data storage devices so the application can be aware of them.
|
protectednoexcept |
Handle platform specific shutdown code.
Calls system functions to release cached values obtained from the platform's operating system.
|
staticnoexcept |
Remove the last entry of a prefix.
Given a prefix number, pop off the last entry so that it effectively goes up one entry in a directory hierarchy. Imagine performing the operation "cd .." on the prefix.
This can force the prefix to become an empty string if the prefix is pointing to a root folder.
Examples:
uPrefixNum | Index to the prefix to modify. |
|
staticnoexcept |
Queue thread.
Internal function to handle async file operations.
pData | Pointer to the parent FileManager object. |
|
staticnoexcept |
Rename a file.
Given a BurgerLib formatted old pathname and new pathname, rename the file at the end of the pathname.
pNewName | Pointer to a "C" string of a BurgerLib path for the new name. |
pOldName | Pointer to a "C" string of a BurgerLib path for the current file name. |
|
staticnoexcept |
Rename a file using Filename.
Given a Filename formatted old pathname and new pathname, rename the file at the end of the pathname.
pNewName | Pointer to a Filename for the new name. |
pOldName | Pointer to a Filename for the current file name. |
|
staticnoexcept |
Save a file.
Given a BurgerLib pathname and a buffer, save the contents of the buffer into a file and close the file.
This function is a quick and easy way to write a buffer from memory directly to disk (Or any other storage medium).
pFileName | Pointer to a "C" string of a BurgerLib path. |
pInput | Pointer to an array of bytes to save |
uLength | Number of bytes in the buffer |
|
staticnoexcept |
Save a file using an OS native pathname.
Given an OS native pathname and a buffer, save the contents of the buffer into a file and close the file.
This function is a quick and easy way to write a buffer from memory directly to disk (Or any other storage medium).
pFileName | Pointer to a Filename object. |
pInput | Pointer to an array of bytes to save |
uLength | Number of bytes in the buffer |
|
staticnoexcept |
Save a text file.
Given a BurgerLib pathname and a buffer, save the contents of the buffer into a file and close the file.
This function is a quick and easy way to write a buffer from memory directly to disk (Or any other storage medium).
pFileName | Pointer to a "C" string of a BurgerLib path. |
pInput | Pointer to an array of bytes to save as a text file. |
uLength | Number of bytes in the buffer |
|
staticnoexcept |
Save a text file using a Filename.
Given a Filename and a buffer, save the contents of the buffer into a file and close the file.
This function is a quick and easy way to write a buffer from memory directly to disk (Or any other storage medium).
pFileName | Pointer to a Filename object. |
pInput | Pointer to an array of bytes to save as a text file. |
uLength | Number of bytes in the buffer |
|
static |
Set a file's type and creator codes.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename, and the creator code of the application that owns this file. This function will set the 4 byte codes for the file.
On non MacOS platforms, this function will perform nothing.
pFileName | Pointer to a "C" string of a BurgerLib pathname |
uCreatorType | A uint32_t of the new file creator code. |
uFileType | A uint32_t of the new file type code. |
|
static |
Set a file's type and creator codes using a native filename.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename, and the creator code of the application that owns this file. This function will set the 4 byte codes for the file.
On non MacOS platforms, this function will perform nothing.
pFileName | Pointer to a Filename of a native OS pathname |
uCreatorType | A uint32_t of the new file creator code. |
uFileType | A uint32_t of the new file type code. |
|
static |
Set a file's creator code.
On MacOS, a file has extended data which includes the application code that owns the file. This function will set the 4 byte code for the file.
On non MacOS platforms, this function will perform nothing.
pFileName | Pointer to a "C" string of a BurgerLib pathname |
uCreatorType | Four byte character code to set. |
|
static |
Set a file's type code using a native filename.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename. This function will set the 4 byte code for the file.
On non MacOS platforms, this function will perform nothing.
pFileName | Pointer to a Filename of a native OS pathname |
uCreatorType | Four byte character code to set. |
|
staticnoexcept |
Set the initial default prefixes for a power up state.
Sets these prefixes based on the current setup of the machine the application is running on.
|
static |
Set a file's type code.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename. This function will set the 4 byte code for the file.
On non MacOS platforms, this function will perform nothing.
pFileName | Pointer to a "C" string of a BurgerLib pathname |
uFileType | Four byte character code to set. |
|
static |
Set a file's type code using a native filename.
On MacOS, a file has extended data which includes the file's type, which is independent of the filename. This function will set the 4 byte code for the file.
On non MacOS platforms, this function will perform nothing.
pFileName | Pointer to a Filename of a native OS pathname, |
uFileType | Four byte character code to set. |
|
staticnoexcept |
Set the contents of a prefix.
Given a prefix number and a "C" string to a new pathname, set that prefix to the new value. The prefix is expanded BEFORE it's applied, so if you set prefix 10 with "10:foo" and prefix 10 was already ":Work:Temp:", then prefix 10 will result in ":Work:Temp:foo:"
Passing an empty string or a nullptr will cause the prefix to be released and considered empty.
uPrefixNum | Index to the requested prefix to obtain |
pPrefixName | Pointer to a "C" string of a new BurgerLib pathname |
|
staticnoexcept |
Set the contents of a prefix with a filename.
Given a prefix number and a Filename that has a new pathname, set that prefix to the new value. The prefix is expanded BEFORE it's applied, so if you set prefix 10 with "10:foo" and prefix 10 was already ":Work:Temp:", then prefix 10 will result in ":Work:Temp:foo:"
Passing an empty string or a nullptr
will cause the prefix to be released and considered empty.
uPrefixNum | Index to the requested prefix to obtain |
pPrefixName | Pointer to a Filename of a new BurgerLib pathname |
|
staticnoexcept |
Shut down the global file system manager.
Call this function once on shutdown to the Burgerlib file manager. This function's primary purpose is to release all allocated memory and send out a report in case any files are still open on debug builds. The application is responsible for shutting down file usage before application shutdown.
|
noexcept |
Wait until all pending file calls are processed.
Test all pending file calls and if any remain that affect the File object, then wait until they are processed.
pFile | Pointer to the File object to test |
|
staticnoexcept |
Find the folder the has the mounted volumes.
Unix like operating systems can't agree on the name of the mount point for all mounted block devices. This function will invoke dark magic on the native linux platform to determine where the folder is located. It's usually /mnt, but for Ubuntu it's /media/<username> etc.
pOutput | String pointer to receive the folder name. |
|
staticnoexcept |
Find the location of /etc/mtab.
Checks for the location of /etc/mtab and if the application has permission to access it. Otherwise, it tries /proc/mounts, and then /proc/self/mounts
rOutput | String that will contain the filename for /etc/mtab |
pProcPath | "C" string containing the name of the /proc directory |
|
staticnoexcept |
Find the location of /proc.
Checks for the location of /proc and if the application has permission to access it. It will check for /proc first, then /proc/self, otherwise it will return nullptr.
|
staticnoexcept |
Create the list of mounted volumes.
Parse /etc/fstab and generate a list of strings of all the valid mounted volumes
rFSTabs | Array to store all the parsed volumes |
|
staticnoexcept |
Create the list of file system types.
Parse /proc/filesystems and generate a list of strings of all the valid mounted file systems.
On Android, this function will likely fail due to strong permissions but will succeed on a rooted device. Android will always return the list at the minimum, ext3
, ext4
, vfat
, msdos
, sdfat
, fuseblk
, f2fs
Linux devices will always return at the minimum, zfs
, wslfs
, drvfs
, smbfs
none
, squashfs
, and swap
are always excluded.
rFSTypes | Array to store all the parsed file systems |
pProcPath | "C" string containing the name of the /proc directory |
|
staticnoexcept |
Create the list of mounted volumes.
Parse /etc/mtab generate a list of strings of all the valid mounted volumes paths. The path /proc/mounts is an acceptable alternate.
rVolumePaths | Array to store all the parsed volumes |
pEtcMtab | Pointer to "C" string path to /etc/mtab |
rFSTypes | Array of valid file systems |
|
noexcept |
Test if there is space in the queue.
If there is not room in the queue for a new entry, wait until a file operation completes so a new entry can be added to the end of the queue.
If there is room, return immediately.
|
static |
Global instance of the file manager.
|
static |
Maximum number of pending IO events(Power of 2)
|
protected |
True if MSDOS has long filename support (MSDOS Only)
|
protected |
Pointer to the /etc/mtab file.
|
protected |
Array of strings from fstab.
|
protected |
Array of strings of file system types.
|
protected |
Semaphore to get a reply from the IO thread for syncing.
|
protected |
Boot volume name in the format ":FooBar" (Zero terminated) (Darwin only)
|
protected |
Name of the MSDos flavor being run.
|
protected |
Array of prefix strings.
|
protected |
Pointer to the /proc pathname or nullptr is no permission exists to access it.
|
protected |
Worker thread record pointer.
|
protected |
Length of the boot volume name (Darwin only)
|
protected |
MSDOS TRUE version (MSDOS Only)
|
protected |
MSDOS version (MSDOS Only)
|
protected |
OEM number (MSDOS Only)
|
protected |
Index to the end of the queue.
|
protected |
Index to the queue start.
|
protected |
Array of string of mounted volume paths.
|
protected |
Volume prefix for paths.