File library fixes
This commit is contained in:
@@ -22,17 +22,12 @@ Value modules::file(std::vector<Value> args) {
|
||||
}
|
||||
std::string buf;
|
||||
std::string retval;
|
||||
bool notfirst = false;
|
||||
while (getline(file, buf)) {
|
||||
if (notfirst) {
|
||||
buf += "\n";
|
||||
} else {
|
||||
notfirst = true;
|
||||
}
|
||||
retval += buf;
|
||||
}
|
||||
file.close();
|
||||
return Value(retval);
|
||||
return Value("\"" + retval + "\"");
|
||||
} else if (args[0].string_val == "readlines") {
|
||||
std::ifstream file(args[1].string_val);
|
||||
if (!file) {
|
||||
@@ -42,7 +37,7 @@ Value modules::file(std::vector<Value> args) {
|
||||
std::string buf;
|
||||
std::vector<Value> retval;
|
||||
while (getline(file, buf)) {
|
||||
retval.push_back(Value(buf));
|
||||
retval.push_back(Value("\"" + buf + "\""));
|
||||
}
|
||||
file.close();
|
||||
return Value(retval);
|
||||
|
||||
Reference in New Issue
Block a user