mod.rs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Extended attribute support
  2. #[cfg(target_os = "macos")] mod xattr_darwin;
  3. #[cfg(target_os = "macos")] pub use self::xattr_darwin::Attribute;
  4. #[cfg(target_os = "linux")] mod xattr_linux;
  5. #[cfg(target_os = "linux")] pub use self::xattr_linux::Attribute;
  6. #[cfg(not(any(target_os = "macos", target_os = "linux")))] use std::old_io as io;
  7. #[cfg(not(any(target_os = "macos", target_os = "linux")))]
  8. #[derive(Clone)]
  9. pub struct Attribute;
  10. #[cfg(not(any(target_os = "macos", target_os = "linux")))]
  11. impl Attribute {
  12. /// Getter for name
  13. pub fn name(&self) -> &str {
  14. unimplemented!()
  15. }
  16. /// Getter for size
  17. pub fn size(&self) -> usize {
  18. unimplemented!()
  19. }
  20. /// Lists the extended attributes. Follows symlinks like `metadata`
  21. pub fn list(_: &Path) -> io::IoResult<Vec<Attribute>> {
  22. Ok(Vec::new())
  23. }
  24. /// Lists the extended attributes. Does not follow symlinks like `symlink_metadata`
  25. pub fn llist(_: &Path) -> io::IoResult<Vec<Attribute>> {
  26. Ok(Vec::new())
  27. }
  28. pub fn feature_implemented() -> bool { false }
  29. }
  30. // Git support
  31. #[cfg(feature="git")] mod git;
  32. #[cfg(feature="git")] pub use self::git::Git;
  33. #[cfg(not(feature="git"))] pub struct Git;
  34. #[cfg(not(feature="git"))] use std::path::Path;
  35. #[cfg(not(feature="git"))] use file::fields;
  36. #[cfg(not(feature="git"))]
  37. impl Git {
  38. pub fn scan(_: &Path) -> Result<Git, ()> {
  39. Err(())
  40. }
  41. pub fn status(&self, _: &Path) -> fields::Git {
  42. panic!("Tried to access a Git repo without Git support!");
  43. }
  44. pub fn dir_status(&self, path: &Path) -> fields::Git {
  45. self.status(path)
  46. }
  47. }