summaryrefslogtreecommitdiff
path: root/crates/vcs_data/src/data/vault
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-10-29 15:28:50 +0800
committerGitHub <noreply@github.com>2025-10-29 15:28:50 +0800
commit4f35da85641549c3e08c4e1b73fccfc7ec9779a2 (patch)
tree360a7c95183bc9800f95fdb34e162383f66daffa /crates/vcs_data/src/data/vault
parent23784691ed4668e4e308fb5af70c2574f5936346 (diff)
parent50945b098e3f6ff16f3f4cf25c2835ddf1e7b3a8 (diff)
Merge pull request #29 from JustEnoughVCS/jvcs_dev_actions
Jvcs dev actions
Diffstat (limited to 'crates/vcs_data/src/data/vault')
-rw-r--r--crates/vcs_data/src/data/vault/service.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/vcs_data/src/data/vault/service.rs b/crates/vcs_data/src/data/vault/service.rs
index 22e91d5..3f59c30 100644
--- a/crates/vcs_data/src/data/vault/service.rs
+++ b/crates/vcs_data/src/data/vault/service.rs
@@ -9,7 +9,7 @@ impl Vault {
}
/// Check if the current Vault is locked
- pub fn is_locked(&self) -> bool {
+ pub fn is_locked(&self) -> bool {
self.lock_file_path().exists()
}
@@ -19,10 +19,7 @@ impl Vault {
return Err(std::io::Error::new(
std::io::ErrorKind::AlreadyExists,
format!(
- "Vault is already locked at {}. \
- To unlock, please stop any running services. \
- If you are certain no services are running, \
- please delete this file",
+ "Vault is locked! This indicates a service is already running here.\nPlease stop other services or delete the lock file at the vault root directory: {}",
self.lock_file_path().display()
),
));
@@ -34,9 +31,10 @@ impl Vault {
/// Unlock the current Vault
pub fn unlock(&self) -> Result<(), std::io::Error> {
if let Err(e) = std::fs::remove_file(self.lock_file_path())
- && e.kind() != std::io::ErrorKind::NotFound {
- return Err(e);
- }
+ && e.kind() != std::io::ErrorKind::NotFound
+ {
+ return Err(e);
+ }
Ok(())
}
}