diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -6,7 +6,7 @@ pub mod db; | |||
6 | pub mod error; | 6 | pub mod error; |
7 | pub mod files; | 7 | pub mod files; |
8 | 8 | ||
9 | use std::io::{Error, ErrorKind}; | 9 | use std::{io::{Error, ErrorKind}, path::Path}; |
10 | 10 | ||
11 | pub use apis::*; | 11 | pub use apis::*; |
12 | pub use commands::*; | 12 | pub use commands::*; |
@@ -33,3 +33,17 @@ impl Modloader { | |||
33 | } | 33 | } |
34 | } | 34 | } |
35 | } | 35 | } |
36 | |||
37 | pub fn devdir(path: &str) -> String { | ||
38 | let p = Path::new(path); | ||
39 | let dev = std::env::var("DEV"); | ||
40 | let lvl = match dev { | ||
41 | Ok(dev) => dev.parse::<i32>().unwrap(), | ||
42 | Err(..) => 0, | ||
43 | }; | ||
44 | if lvl >= 1 { | ||
45 | format!("./dev/{}", p.file_name().unwrap().to_str().unwrap()) | ||
46 | } else { | ||
47 | String::from(path) | ||
48 | } | ||
49 | } | ||