update modules
This commit is contained in:
@ -172,7 +172,7 @@ fn append_index_block(source: &Path, destination: &Path) -> io::Result<()> {
|
||||
let source_components: Vec<_> = source.iter().collect();
|
||||
let base_system_folder = source_components[4].to_str().unwrap();
|
||||
|
||||
let index_conflict_path = Path::new("/pkg/gnu/sexpkg/etc/index-conflict.md");
|
||||
let index_conflict_path = Path::new("/pkg/gnu/aeropkg/etc/index-conflict.md");
|
||||
let content = fs::read_to_string(&index_conflict_path)?;
|
||||
|
||||
let start_marker = format!("``` cfg *** {} ***", base_system_folder);
|
||||
|
||||
@ -2,3 +2,4 @@ pub mod hardcopy;
|
||||
pub mod parser;
|
||||
pub mod deletecopy;
|
||||
pub mod shell;
|
||||
pub mod mv;
|
||||
|
||||
26
src/utils/mv.rs
Normal file
26
src/utils/mv.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use rayon::prelude::*;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn mv(source: &Path, destination: &Path) -> io::Result<()> {
|
||||
let metadata = fs::symlink_metadata(source)?;
|
||||
if metadata.file_type().is_file() {
|
||||
fs::rename(source, destination).ok();
|
||||
} else if metadata.file_type().is_dir() {
|
||||
fs::create_dir_all(destination)?;
|
||||
let entries: Vec<_> = fs::read_dir(source)?.collect::<io::Result<Vec<_>>>()?;
|
||||
entries.par_iter().try_for_each(|entry| {
|
||||
let path = entry.path();
|
||||
if let Some(file_name) = path.file_name() {
|
||||
let dest_path = destination.join(file_name);
|
||||
mv(&path, &dest_path)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
})?;
|
||||
} else if metadata.file_type().is_symlink() {
|
||||
fs::rename(source, destination).ok();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -62,7 +62,7 @@ pub fn get_patch_script<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
|
||||
|
||||
|
||||
pub fn get_repo_list() -> io::Result<Vec<String>> {
|
||||
let file_path = crate::commands::get_var_path().join("sexpkg.md");
|
||||
let file_path = crate::commands::get_var_path().join("aeropkg.md");
|
||||
|
||||
let block = extract_block(file_path, "``` cfg *** Repository list and priority ***", "```")?;
|
||||
|
||||
@ -86,7 +86,7 @@ pub fn get_repo_addr(repo: &str) -> io::Result<String> {
|
||||
let file_path = exe_path
|
||||
.parent()
|
||||
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "Failed to get executable directory"))?
|
||||
.join("../etc/sexpkg.md");
|
||||
.join("../etc/aeropkg.md");
|
||||
|
||||
let block = extract_block(file_path, "``` sh *** Repository list and priority ***", "```")?;
|
||||
|
||||
@ -157,7 +157,7 @@ pub fn get_index_conflict<P: AsRef<Path>>(destination: P) -> io::Result<PathBuf>
|
||||
|
||||
let system_struct_folder = parts[3]; // bin, sbin, include, lib, share
|
||||
|
||||
let etc = Path::new("/pkg/gnu/sexpkg/etc");
|
||||
let etc = Path::new("/pkg/gnu/aeropkg/etc");
|
||||
let cfg_path = etc.join("index-conflict.md");
|
||||
|
||||
let start_marker = format!("``` cfg *** {} ***", system_struct_folder);
|
||||
|
||||
Reference in New Issue
Block a user