summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2022-12-28 13:15:10 +0100
committerfxqnlr <[email protected]>2022-12-28 13:15:10 +0100
commit5326d48f6e0a88ad42005c39b73f7baaf91c9b86 (patch)
tree154ff8715a2e0f121b285870d52c50f1737f7abc /src/lib.rs
parente1c79889d3bf02c8d131d642fed8ba7ef9521bf4 (diff)
downloadmodlist-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.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 971f544..17ad6b9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,7 +6,7 @@ pub mod db;
6pub mod error; 6pub mod error;
7pub mod files; 7pub mod files;
8 8
9use std::io::{Error, ErrorKind}; 9use std::{io::{Error, ErrorKind}, path::Path};
10 10
11pub use apis::*; 11pub use apis::*;
12pub use commands::*; 12pub use commands::*;
@@ -33,3 +33,17 @@ impl Modloader {
33 } 33 }
34 } 34 }
35} 35}
36
37pub 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}