mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
New world and player files format
This commit is contained in:
parent
b62b7bf2bb
commit
2f9244c17c
6 changed files with 168 additions and 79 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <memory>
|
||||
#include <stdint.h>
|
||||
#include <stdexcept>
|
||||
#include "../coders/json.h"
|
||||
|
||||
using std::ios;
|
||||
using std::string;
|
||||
|
|
@ -71,4 +72,14 @@ bool files::write_string(path filename, const string content) {
|
|||
}
|
||||
file << content;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
json::JObject* files::read_json(path file) {
|
||||
string text = files::read_string(file);
|
||||
try {
|
||||
return json::parse(file.string(), text);
|
||||
} catch (const parsing_error& error) {
|
||||
std::cerr << error.errorLog() << std::endl;
|
||||
throw std::runtime_error("could not to parse "+file.string());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue