mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
Implement Syncback to support converting Roblox files to a Rojo project (#937)
This is a very large commit. Consider checking the linked PR for more information.
This commit is contained in:
@@ -16,6 +16,7 @@ pub fn match_trailing<'a>(input: &'a str, suffix: &str) -> Option<&'a str> {
|
||||
pub trait PathExt {
|
||||
fn file_name_ends_with(&self, suffix: &str) -> bool;
|
||||
fn file_name_trim_end<'a>(&'a self, suffix: &str) -> anyhow::Result<&'a str>;
|
||||
fn parent_err(&self) -> anyhow::Result<&Path>;
|
||||
}
|
||||
|
||||
impl<P> PathExt for P
|
||||
@@ -40,6 +41,12 @@ where
|
||||
match_trailing(file_name, suffix)
|
||||
.with_context(|| format!("Path did not end in {}: {}", suffix, path.display()))
|
||||
}
|
||||
|
||||
fn parent_err(&self) -> anyhow::Result<&Path> {
|
||||
let path = self.as_ref();
|
||||
path.parent()
|
||||
.with_context(|| format!("Path does not have a parent: {}", path.display()))
|
||||
}
|
||||
}
|
||||
|
||||
// TEMP function until rojo 8.0, when it can be replaced with bool::default (aka false)
|
||||
|
||||
Reference in New Issue
Block a user