std::vector<std::uint8_t> data;
latin1::from_utf8(str, data);
write_file(data.data(), data.size(), location, offset, rewrite);
+ ReportSuccess(picojson::value{(double)data.size()}, out);
} else { // default: UTF-8
const std::uint8_t* buf = (const std::uint8_t*)str.c_str();
std::size_t len = str.length();
write_file(buf, len, location, offset, rewrite);
+ ReportSuccess(picojson::value{(double)str.size()}, out);
}
} catch (std::runtime_error& e) {
LoggerE("Cannot write to file %s, cause: %s", location.c_str(), e.what());
PrepareError(FilesystemError::Other, out);
return;
}
-
- ReportSuccess(out);
}
void FilesystemInstance::FileWriteBytes(const picojson::value& args, picojson::object& out) {
throw new WebAPIException(WebAPIException.IO_ERR, 'Could not write');
}
can_change_size = true;
- this.position = this.position + args.stringData.length;
+ var written_bytes = native_.getResultObject(result);
+ this.position = this.position + written_bytes;
can_change_size = false;
this._rewrite = false;
}