diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-16 21:22:03 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-16 21:22:03 +0200 |
commit | d13d131130ab53fb8ee7d49d2b40718622a4ab11 (patch) | |
tree | 7966ffc15804369d43c6a0cdba7e7505fea512d3 /planetwars-server/src/modules/bots.rs | |
parent | ec5c91d37b46cb3cec4878176469c66d2304dadd (diff) | |
download | planetwars.dev-d13d131130ab53fb8ee7d49d2b40718622a4ab11.tar.xz planetwars.dev-d13d131130ab53fb8ee7d49d2b40718622a4ab11.zip |
move storage paths to GlobalConfig
Diffstat (limited to 'planetwars-server/src/modules/bots.rs')
-rw-r--r-- | planetwars-server/src/modules/bots.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/planetwars-server/src/modules/bots.rs b/planetwars-server/src/modules/bots.rs index b82ad41..5513539 100644 --- a/planetwars-server/src/modules/bots.rs +++ b/planetwars-server/src/modules/bots.rs @@ -2,17 +2,18 @@ use std::path::PathBuf; use diesel::{PgConnection, QueryResult}; -use crate::{db, util::gen_alphanumeric, BOTS_DIR}; +use crate::{db, util::gen_alphanumeric, GlobalConfig}; /// Save a string containing bot code as a code bundle. pub fn save_code_string( bot_code: &str, bot_id: Option<i32>, conn: &PgConnection, + config: &GlobalConfig, ) -> QueryResult<db::bots::BotVersion> { let bundle_name = gen_alphanumeric(16); - let code_bundle_dir = PathBuf::from(BOTS_DIR).join(&bundle_name); + let code_bundle_dir = PathBuf::from(&config.bots_directory).join(&bundle_name); std::fs::create_dir(&code_bundle_dir).unwrap(); std::fs::write(code_bundle_dir.join("bot.py"), bot_code).unwrap(); |