equal
deleted
inserted
replaced
5 // This software may be used and distributed according to the terms of the |
5 // This software may be used and distributed according to the terms of the |
6 // GNU General Public License version 2 or any later version. |
6 // GNU General Public License version 2 or any later version. |
7 |
7 |
8 //! Contains useful functions, traits, structs, etc. for use in core. |
8 //! Contains useful functions, traits, structs, etc. for use in core. |
9 |
9 |
|
10 use crate::errors::{HgError, IoErrorContext}; |
10 use crate::utils::hg_path::HgPath; |
11 use crate::utils::hg_path::HgPath; |
11 use std::{io::Write, ops::Deref}; |
12 use std::{io::Write, ops::Deref}; |
12 |
13 |
13 pub mod files; |
14 pub mod files; |
14 pub mod hg_path; |
15 pub mod hg_path; |
174 Some(&s[..s.len() - suffix.len()]) |
175 Some(&s[..s.len() - suffix.len()]) |
175 } else { |
176 } else { |
176 None |
177 None |
177 } |
178 } |
178 } |
179 } |
|
180 |
|
181 pub fn current_dir() -> Result<std::path::PathBuf, HgError> { |
|
182 std::env::current_dir().map_err(|error| HgError::IoError { |
|
183 error, |
|
184 context: IoErrorContext::CurrentDir, |
|
185 }) |
|
186 } |