get nextsync_root
This commit is contained in:
1 parent
14183da3ae
commit
04bef223a3
2 files changed
+20
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
pub mod path;
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
use std::env;
|
||||||
|
use std::path::{PathBuf, Path};
|
||||||
|
|
||||||
|
pub fn nextsync_root() -> Option<PathBuf> {
|
||||||
|
let mut path = env::current_dir().unwrap();
|
||||||
|
let root = loop {
|
||||||
|
path.push(".nextsync");
|
||||||
|
if path.exists() {
|
||||||
|
path.pop();
|
||||||
|
break Some(path);
|
||||||
|
}
|
||||||
|
path.pop();
|
||||||
|
path.pop();
|
||||||
|
if path == Path::new("/") {
|
||||||
|
break None;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
root
|
||||||
|
}
|
||||||
Reference in new issue
Block a user