diff options
author | fxqnlr <[email protected]> | 2022-12-28 13:15:10 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2022-12-28 13:15:10 +0100 |
commit | 5326d48f6e0a88ad42005c39b73f7baaf91c9b86 (patch) | |
tree | 154ff8715a2e0f121b285870d52c50f1737f7abc /src/lib.rs | |
parent | e1c79889d3bf02c8d131d642fed8ba7ef9521bf4 (diff) | |
download | modlist-5326d48f6e0a88ad42005c39b73f7baaf91c9b86.tar modlist-5326d48f6e0a88ad42005c39b73f7baaf91c9b86.tar.gz modlist-5326d48f6e0a88ad42005c39b73f7baaf91c9b86.zip |
added devdir; better config dir
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 | } | ||