Implement File System Features Into the Script Language #6

Open
opened 2024-08-27 12:03:13 +02:00 by faraphel · 1 comment
Owner

File System implementation in the Script Language

The script language shall be able to access the virtual file system thanks to a Path object, allowing for the manipulation of path, directory exploration, directory creation, etc... And a File object allowing for the manipulation of the content of a file.

# File System implementation in the Script Language The script language shall be able to access the virtual file system thanks to a `Path` object, allowing for the manipulation of path, directory exploration, directory creation, etc... And a `File` object allowing for the manipulation of the content of a file.
faraphel added the
enhancement
label 2024-08-27 12:03:13 +02:00
faraphel self-assigned this 2024-08-27 12:03:13 +02:00
faraphel added this to the Atlas-Launcher project 2024-08-27 12:03:13 +02:00
Author
Owner

When loading the features into the AngelScript engine, it was planned to register the Path object with a special factory function : this factory function was supposed to bind the VirtualFileSystem object to the constructor of the Path so that it can directly be used like Path("file.txt"). Sadly, doing so require a capturing lambda function (std::bind work the same way), which cannot be converted into a function pointer, which AngelScript use internally.

A new type, FileSystem, have been created for this occasion. It cannot be instantiated, but a global variable fileSystem allow for accessing a Path thanks to the FileSystem::getPath function.

Path have been implemented with most of the required functionalities, alongside File with read and write capacities. More advanced features will be implemented later, like text handling with potential encoding support or Path manipulation with withSuffix or withBasename functions.

When loading the features into the AngelScript engine, it was planned to register the `Path` object with a special factory function : this factory function was supposed to bind the `VirtualFileSystem` object to the constructor of the `Path` so that it can directly be used like `Path("file.txt")`. Sadly, doing so require a capturing lambda function (std::bind work the same way), which cannot be converted into a function pointer, which AngelScript use internally. A new type, `FileSystem`, have been created for this occasion. It cannot be instantiated, but a global variable `fileSystem` allow for accessing a `Path` thanks to the `FileSystem::getPath` function. `Path` have been implemented with most of the required functionalities, alongside `File` with read and write capacities. More advanced features will be implemented later, like text handling with potential encoding support or Path manipulation with `withSuffix` or `withBasename` functions.
faraphel added a new dependency 2024-08-27 12:09:36 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#2 Implement the Core}
Atlas/Atlas-Launcher
Reference: Atlas/Atlas-Launcher#6
No description provided.