mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Enhance syncback functionality and improve code readability
- Refactored the syncback process to streamline directory management and improve handling of class transitions in clean mode. - Updated the `clone_tree_filtered` function to accept a tuple of compiled Globs and original pattern strings, enhancing flexibility in ignore pattern handling. - Simplified logic for checking if paths are inside removed directories, improving code clarity. - Added detailed comments to clarify the purpose of new logic for handling script directory transitions, ensuring better maintainability. - Improved logging for better traceability during syncback operations.
This commit is contained in:
parent
1534a54808
commit
411f79ee81
10 changed files with 232 additions and 65 deletions
|
|
@ -625,14 +625,15 @@ impl ApiService {
|
|||
// We need to convert from standalone (e.g., MyScript.server.luau)
|
||||
// to directory format (e.g., MyScript/init.server.luau).
|
||||
let script_name = added.name.as_str();
|
||||
let parent_dir = existing_path
|
||||
.parent()
|
||||
.unwrap_or(existing_path);
|
||||
let parent_dir = existing_path.parent().unwrap_or(existing_path);
|
||||
let new_dir = parent_dir.join(script_name);
|
||||
|
||||
// Create the directory
|
||||
fs::create_dir_all(&new_dir).with_context(|| {
|
||||
format!("Failed to create directory for script with children: {}", new_dir.display())
|
||||
format!(
|
||||
"Failed to create directory for script with children: {}",
|
||||
new_dir.display()
|
||||
)
|
||||
})?;
|
||||
|
||||
// Determine the init file name based on class
|
||||
|
|
@ -652,7 +653,10 @@ impl ApiService {
|
|||
// Remove the old standalone file
|
||||
if existing_path.exists() && existing_path != init_path {
|
||||
fs::remove_file(existing_path).with_context(|| {
|
||||
format!("Failed to remove old standalone script: {}", existing_path.display())
|
||||
format!(
|
||||
"Failed to remove old standalone script: {}",
|
||||
existing_path.display()
|
||||
)
|
||||
})?;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue