fix: Symlink Detection
This commit is contained in:
parent
59c2997dc2
commit
ccc2dbc547
1 changed files with 28 additions and 8 deletions
22
src/main.rs
22
src/main.rs
|
@ -82,7 +82,9 @@ impl FileInfo
|
||||||
{
|
{
|
||||||
//Recursivity Problem
|
//Recursivity Problem
|
||||||
println!("\n\tError: Symlink Transfers've not Supported yet\n");
|
println!("\n\tError: Symlink Transfers've not Supported yet\n");
|
||||||
return;
|
//return;
|
||||||
|
self.open_file(debug_mode);
|
||||||
|
self.send_file(stream, debug_mode);
|
||||||
}
|
}
|
||||||
else if Metadata::is_file(metadata)
|
else if Metadata::is_file(metadata)
|
||||||
{
|
{
|
||||||
|
@ -122,6 +124,23 @@ impl FileInfo
|
||||||
self.size_current = 0;
|
self.size_current = 0;
|
||||||
}
|
}
|
||||||
fn read_metadata(&mut self, debug_mode:&bool)
|
fn read_metadata(&mut self, debug_mode:&bool)
|
||||||
|
{
|
||||||
|
let path = PathBuf::from(self.location.as_ref().unwrap());
|
||||||
|
if path.is_symlink()
|
||||||
|
{
|
||||||
|
match path.symlink_metadata()
|
||||||
|
{
|
||||||
|
Ok(metadata) =>
|
||||||
|
{
|
||||||
|
self.metadata = Some(metadata);
|
||||||
|
}
|
||||||
|
Err(err_val) =>
|
||||||
|
{
|
||||||
|
println!("Error: Symlink Metadata -> {:#?} | Error: {}", &self.location, err_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
match fs::metadata(&self.location.as_ref().unwrap())
|
match fs::metadata(&self.location.as_ref().unwrap())
|
||||||
{
|
{
|
||||||
|
@ -139,6 +158,7 @@ impl FileInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fn open_file(&mut self,debug_mode:&bool)
|
fn open_file(&mut self,debug_mode:&bool)
|
||||||
{
|
{
|
||||||
match File::options().read(true).write(true).open(self.location.as_ref().unwrap())
|
match File::options().read(true).write(true).open(self.location.as_ref().unwrap())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue