mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Refactor JSON handling and improve code clarity
- Updated error messages in Http.jsonDecode for better context. - Enhanced serialization error handling in CompactJson5Serializer. - Reformatted struct definitions in tests for improved readability. - Adjusted assertions in tests for better clarity and consistency. - Refactored project file name checks for improved readability.
This commit is contained in:
parent
fdd1d145cf
commit
2b716351c1
4 changed files with 48 additions and 15 deletions
|
|
@ -16,7 +16,11 @@ use crate::{
|
|||
};
|
||||
|
||||
/// Represents 'default' project names that act as `init` files
|
||||
pub static DEFAULT_PROJECT_NAMES: [&str; 3] = ["default.project.json", "default.project.jsonc", "default.project.json5"];
|
||||
pub static DEFAULT_PROJECT_NAMES: [&str; 3] = [
|
||||
"default.project.json",
|
||||
"default.project.jsonc",
|
||||
"default.project.json5",
|
||||
];
|
||||
|
||||
/// Error type returned by any function that handles projects.
|
||||
#[derive(Debug, Error)]
|
||||
|
|
@ -146,7 +150,11 @@ impl Project {
|
|||
pub fn is_project_file(path: &Path) -> bool {
|
||||
path.file_name()
|
||||
.and_then(|name| name.to_str())
|
||||
.map(|name| name.ends_with(".project.json") || name.ends_with(".project.jsonc") || name.ends_with(".project.json5"))
|
||||
.map(|name| {
|
||||
name.ends_with(".project.json")
|
||||
|| name.ends_with(".project.jsonc")
|
||||
|| name.ends_with(".project.json5")
|
||||
})
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue