Add support for TOML files (#633)

TOML maps well to Lua, is easier to read and write than JSON, and is
commonly used by Roblox tools.

Use cases:
* Put game, plugin, or library config in a toml file
* Sync in toml files generated by tools
* Sync in config files for tools so that the game can double-check that
the config file has been followed. (e.g. check that packages match
versions specified in wally.toml)
This commit is contained in:
Shae
2023-07-14 15:36:50 -05:00
committed by GitHub
parent 6e40993199
commit 6e320b1fd5
6 changed files with 151 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ mod meta_file;
mod project;
mod rbxm;
mod rbxmx;
mod toml;
mod txt;
mod util;
@@ -32,6 +33,7 @@ use self::{
project::snapshot_project,
rbxm::snapshot_rbxm,
rbxmx::snapshot_rbxmx,
toml::snapshot_toml,
txt::snapshot_txt,
util::PathExt,
};
@@ -117,6 +119,8 @@ pub fn snapshot_from_vfs(
return Ok(None);
} else if path.file_name_ends_with(".json") {
return snapshot_json(context, vfs, path);
} else if path.file_name_ends_with(".toml") {
return snapshot_toml(context, vfs, path);
} else if let Ok(name) = csv_name {
match name {
// init csv are handled elsewhere and should not turn into