Coin de Gamma
3 months ago
5 changed files with 59 additions and 30 deletions
@ -0,0 +1,18 @@
|
||||
use std::process::Command; |
||||
|
||||
use std::io; |
||||
|
||||
|
||||
pub struct Git { |
||||
} |
||||
|
||||
impl Git { |
||||
pub fn commit(db_path: String) -> io::Result<()> { |
||||
// TODO: impllement
|
||||
// Command::new("git")
|
||||
// .arg("add")
|
||||
Ok(()) |
||||
|
||||
} |
||||
} |
||||
|
@ -0,0 +1,24 @@
|
||||
use std::env; |
||||
use std::io; |
||||
|
||||
|
||||
static ENV_MPS_HOME: &str = "MPS_HOME"; |
||||
|
||||
static PATH_STORAGE: &str = "storage"; // should be under git
|
||||
static PATH_DB: &str = "db.mps"; |
||||
|
||||
|
||||
pub fn get_storage_path() -> io::Result<String> { |
||||
let mps_home = env::var(ENV_MPS_HOME).map_err(|err| { |
||||
io::Error::new(io::ErrorKind::NotFound, format!("{} error: {}", ENV_MPS_HOME, err)) |
||||
})?; |
||||
let result = format!("{}/{}", mps_home, PATH_STORAGE); |
||||
Ok(result) |
||||
} |
||||
|
||||
pub fn get_db_path() -> io::Result<String> { |
||||
let st = get_storage_path()?; |
||||
let result = format!("{}/{}", st, PATH_DB); |
||||
Ok(result) |
||||
} |
||||
|
Loading…
Reference in new issue