You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Sets all permission in a directory recursively.
@@ -78,13 +124,20 @@ impl MovementNode {
78
124
79
125
// Copy the entire .movement directory recursively
80
126
let movement_dir = dir.join(".movement");
81
-
copy_dir_recursive(&movement_dir,&debug_dir).context("failed to copy movement dir")?;
127
+
128
+
// set the permissions on the movement dir to 755
129
+
// Note: this would mess up celestia node permissions, but we don't care about that here.
130
+
// We really only care about maptos db permissions.
131
+
fs::set_permissions(&movement_dir,Permissions::from_mode(0o755)).context(format!("failed to set permissions on the movement directory {}", movement_dir.display()))?;
132
+
133
+
// don't copy anything from the celestia directory
134
+
copy_dir_recursive_with_ignore(&movement_dir,[PathBuf::from("celestia")],&debug_dir).context("failed to copy movement dir")?;
82
135
83
136
// Set all permissions in the debug directory recursively
84
137
// Note: this would mess up celestia node permissions, but we don't care about that here.
85
138
// We really only care about maptos db permissions.
86
139
// TODO: tighten the copying accordingly.
87
-
set_permissions_recursive(&debug_dir,Permissions::from_mode(0o755)).context("failed to set permissions")?;
140
+
set_permissions_recursive(&debug_dir,Permissions::from_mode(0o755)).context(format!("failed to set permissions on the debug directory {}", debug_dir.display()))?;
88
141
89
142
let movement_args = MovementArgs{movement_path:Some(debug_dir.display().to_string())};
90
143
@@ -419,3 +472,40 @@ impl<'a> Iterator for AccountAddressIterator<'a> {
let file_path = temp_dir.path().join("maptos").join("test_file.txt");
489
+
fs::create_dir_all(file_path.parent().context("failed to get parent directory for file that should be copied")?).context("failed to create directory")?;
490
+
fs::write(file_path,"test").context("failed to write file that should be copied")?;
491
+
492
+
// write a file that should not be copied
493
+
let file_path = temp_dir.path().join("celestia").join("test_file2.txt");
494
+
fs::create_dir_all(file_path.parent().context("failed to get parent directory for file that should not be copied")?).context("failed to create directory")?;
495
+
fs::write(file_path,"test").context("failed to write file that should not be copied")?;
496
+
497
+
// create the target temp dir
498
+
let dst = TempDir::new()?;
499
+
500
+
// copy the file to a new dir, ignoring celestia directory
501
+
copy_dir_recursive_with_ignore(&temp_dir.path(),[PathBuf::from("celestia")],&dst.path()).context("failed to copy directory")?;
0 commit comments