diff options
Diffstat (limited to 'crates/common/flockfile/src/windows.rs')
-rw-r--r-- | crates/common/flockfile/src/windows.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/common/flockfile/src/windows.rs b/crates/common/flockfile/src/windows.rs new file mode 100644 index 00000000..41542414 --- /dev/null +++ b/crates/common/flockfile/src/windows.rs @@ -0,0 +1,32 @@ +use std::{ + io, + path::{Path, PathBuf}, +}; + +#[derive(thiserror::Error, Debug)] +pub enum FlockfileError { + #[error(transparent)] + IoError(#[from] std::io::Error), +} + +#[derive(Debug)] +pub struct Flockfile { + pub path: PathBuf, +} + +impl Flockfile { + pub fn new_lock(lock_name: impl AsRef<Path>) -> Result<Flockfile, FlockfileError> { + let path = Path::new("/no/lock/on/windows").join(lock_name); + Ok(Flockfile { path: path }) + } + + pub fn unlock(self) -> Result<(), io::Error> { + Ok(()) + } +} + +impl AsRef<Path> for Flockfile { + fn as_ref(&self) -> &Path { + self.path.as_ref() + } +} |