Skip to content

Commit

Permalink
Merge pull request #7 from nibblebits/dev
Browse files Browse the repository at this point in the history
Fixed a bug where directories are loaded as files
  • Loading branch information
nibblebits authored Nov 2, 2018
2 parents b9e4652 + b7deddd commit c3f3963
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

// Marble versioning information
#define MARBLE_MAJOR_CODENAME "Clearies"
#define MARBLE_VERSION "0.6.0"
#define MARBLE_VERSION "0.6.1"

#define MAX_KEYWORD_SIZE 15
#define MAX_OPERATORS_SIZE 3
Expand Down
7 changes: 7 additions & 0 deletions src/system/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ Splitter Interpreter::loadScript(const char *filename)
this->filename = filename;
if (!hasRunScript(filename))
this->scripts_run.push_back(getAbsolutePath(std::string(filename)));

// Lets load this script
FILE *file = fopen(filename, "r");
if (!file)
Expand All @@ -689,6 +690,12 @@ Splitter Interpreter::loadScript(const char *filename)
throw IOException("Failed to seek to the end of the file: " + std::string(filename));
}

std::string filename_str = std::string(filename);
if (!isFile(filename_str))
{
throw IOException("The provided file: " + filename_str + " is a directory");
}

long data_len = ftell(file);
rewind(file);
char *data = new char[data_len];
Expand Down

0 comments on commit c3f3963

Please sign in to comment.