mod directory;
pub(super) use directory::ScratchParent;
pub use directory::{
PrivateTempDir, create_private_dir_all, private_named_dir, private_tempdir_in,
};
#[cfg(target_os = "macos")]
pub(super) mod macos;
mod pinned;
#[cfg(unix)]
mod unix;
#[cfg(windows)]
mod windows;
pub use pinned::{PinnedDir, PinnedFile, open_workspace_file};
#[cfg(unix)]
pub use unix::*;
#[cfg(windows)]
pub use windows::{
PRIVATE_DIRECTORY, PRIVATE_FILE, create_private_dir, create_private_file, file_identity,
is_owner_only, is_private_dir, is_private_file, private_options, remove_tree, restrict_file,
sync_dir, user_identity,
};
#[cfg(windows)]
pub use windows::Local as OwnerDescriptor;
#[cfg(windows)]
pub fn owner_descriptor() -> std::io::Result<OwnerDescriptor> {
windows::owner_only(false)
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct FileIdentity {
volume: u64,
index: u128,
}
impl FileIdentity {
pub fn parts(self) -> (u64, u128) {
(self.volume, self.index)
}
}
fn checked_basename(name: &str) -> std::io::Result<()> {
if !super::files::portable_basename(name) {
return Err(std::io::ErrorKind::InvalidInput.into());
}
Ok(())
}
#[cfg(test)]
mod tests;