From 97d79f5747e58ef7f44c64a3dd1e24947fb7ddd7 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 28 Apr 2025 01:38:04 +0200 Subject: [PATCH] Rename methods for clarity Path resolving methods now start with "path". --- gdn/src/data/datadir.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdn/src/data/datadir.rs b/gdn/src/data/datadir.rs index 6b38341..be99cbb 100644 --- a/gdn/src/data/datadir.rs +++ b/gdn/src/data/datadir.rs @@ -78,17 +78,17 @@ impl UnlockedDataDir { &self.path } - fn version_file(&self) -> PathBuf { + fn path_version_file(&self) -> PathBuf { self.path.join("VERSION") } - fn lock_file(&self) -> PathBuf { + fn path_lock_file(&self) -> PathBuf { self.path.join("LOCK") } pub fn lock(self) -> anyhow::Result { Ok(LockedDataDir { - lockfile: LockFile::lock(self.lock_file())?, + lockfile: LockFile::lock(self.path_lock_file())?, unlocked: self, }) } @@ -114,7 +114,7 @@ impl UnlockedDataDir { } pub(super) fn read_version(&self) -> anyhow::Result { - let path = self.version_file(); + let path = self.path_version_file(); match self.read_string_optional(&path)? { None if self.path.exists() => Err(anyhow!("found data dir without version number")), None => Ok(0), @@ -129,7 +129,7 @@ impl UnlockedDataDir { if actual != expected { bail!( "expected version {expected}, but found {actual} at {}", - self.version_file().display() + self.path_version_file().display() ); } Ok(()) @@ -159,7 +159,7 @@ impl LockedDataDir { } pub(super) fn write_version(&self, version: u32) -> anyhow::Result<()> { - self.write_string(&self.version_file(), &format!("{version}\n")) + self.write_string(&self.path_version_file(), &format!("{version}\n")) } }