Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/UFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ bool UFile::open(String filename, FileMode mode) {
return open(filename.c_str(), mode);
}

bool UFile::open(FileMode mode) {
if (path.empty()) {
// Path is not set
return false;
}

return open(path.c_str(), mode);
}

void UFile::close() {
// Close the file
if (filePointer != nullptr) {
Expand Down
6 changes: 6 additions & 0 deletions src/UFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class UFile{
*/
bool open(String filename, FileMode mode);

/**
* @brief Opens a file that was already initialized with a path.
* @param mode The file mode (READ, WRITE, or APPEND). The default is READ.
* @return True if the file was opened successfully, false otherwise.
*/
bool open(FileMode mode = FileMode::READ);

/**
* @brief Closes the file and releases any allocated resources.
Expand Down
Loading