mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
Reserve names starting with a dollar sign, closes #191.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
* Added support for live-syncing `CollectionService` tags.
|
* Added support for live-syncing `CollectionService` tags.
|
||||||
* Added a warning when building binary place files, since they're still experimental and have bugs.
|
* Added a warning when building binary place files, since they're still experimental and have bugs.
|
||||||
* Added a warning when trying to use Rojo 0.5.x with a Rojo 0.4.x-only project.
|
* Added a warning when trying to use Rojo 0.5.x with a Rojo 0.4.x-only project.
|
||||||
|
* Added a warning when a Rojo project contains keys that start with `$`, which are reserved names. ([#191](https://github.com/LPGhatguy/rojo/issues/191))
|
||||||
* Added an icon to the plugin's toolbar button
|
* Added an icon to the plugin's toolbar button
|
||||||
* Changed the plugin to use a docking widget for all UI.
|
* Changed the plugin to use a docking widget for all UI.
|
||||||
* Changed the plugin to ignore unknown properties when live-syncing.
|
* Changed the plugin to ignore unknown properties when live-syncing.
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub static COMPAT_PROJECT_FILENAME: &'static str = "roblox-project.json";
|
|||||||
/// want to do things like transforming paths to be absolute before handing them
|
/// want to do things like transforming paths to be absolute before handing them
|
||||||
/// off to the rest of Rojo, we use this intermediate struct.
|
/// off to the rest of Rojo, we use this intermediate struct.
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
||||||
struct SourceProject {
|
struct SourceProject {
|
||||||
name: String,
|
name: String,
|
||||||
tree: SourceProjectNode,
|
tree: SourceProjectNode,
|
||||||
@@ -274,6 +274,17 @@ pub struct ProjectNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ProjectNode {
|
impl ProjectNode {
|
||||||
|
fn validate_reserved_names(&self) {
|
||||||
|
for (name, child) in &self.children {
|
||||||
|
if name.starts_with('$') {
|
||||||
|
warn!("Keys starting with '$' are reserved by Rojo to ensure forward compatibility.");
|
||||||
|
warn!("This project uses the key '{}', which should be renamed.", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
child.validate_reserved_names();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn to_source_node(&self, project_file_location: &Path) -> SourceProjectNode {
|
fn to_source_node(&self, project_file_location: &Path) -> SourceProjectNode {
|
||||||
let children = self.children.iter()
|
let children = self.children.iter()
|
||||||
.map(|(key, value)| (key.clone(), value.to_source_node(project_file_location)))
|
.map(|(key, value)| (key.clone(), value.to_source_node(project_file_location)))
|
||||||
@@ -513,6 +524,8 @@ impl Project {
|
|||||||
warn!(".project.json extension. This helps Rojo differentiate project files from");
|
warn!(".project.json extension. This helps Rojo differentiate project files from");
|
||||||
warn!("other JSON files!");
|
warn!("other JSON files!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.tree.validate_reserved_names();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Issues a warning if no Rojo 0.5.x project is found, but there's a legacy
|
/// Issues a warning if no Rojo 0.5.x project is found, but there's a legacy
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "legacy-0.5.x-reserved-names",
|
||||||
|
"tree": {
|
||||||
|
"$className": "Folder",
|
||||||
|
"$warn-about-me": {
|
||||||
|
"$className": "Folder"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user