Skip to content

Commit

Permalink
Fixed disabling /bin/boot.bin mechanics.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed May 18, 2024
1 parent b8425e1 commit 40c9a87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/rishka_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ char* RishkaVM::getArgValue(const uint8_t index) const {
return this->argv[index];
}

bool RishkaVM::loadFile(const char* fileName) {
bool RishkaVM::loadFile(const char* fileName, bool disableBoot) {
String absoluteFilename = "/bin/" + String(fileName) + ".bin";
if(!SD.exists(absoluteFilename))
absoluteFilename = rishka_sanitize_path(
Expand All @@ -71,7 +71,7 @@ bool RishkaVM::loadFile(const char* fileName) {
if(!SD.exists(absoluteFilename))
return false;

if(absoluteFilename == "/bin/boot.bin")
if(!disableBoot && absoluteFilename == "/bin/boot.bin")
return false;

File file = SD.open(absoluteFilename);
Expand Down
3 changes: 2 additions & 1 deletion src/rishka_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ class RishkaVM final {
* for execution.
*
* @param fileName The name of the program file to be loaded.
* @param disableBoot Disable loading the /bin/boot.bin program.
* @return true if the file is loaded successfully, false otherwise.
*/
bool loadFile(const char* fileName);
bool loadFile(const char* fileName, bool disableBoot = true);

/**
* @brief Runs the Rishka virtual machine instance.
Expand Down

0 comments on commit 40c9a87

Please sign in to comment.