Skip to content

Commit

Permalink
Started work on internal template storage
Browse files Browse the repository at this point in the history
  • Loading branch information
TCA166 committed May 12, 2024
1 parent 639aa28 commit b100b1a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[profile.release]
debug = true

[dependencies]
minijinja = "1.0.20"
serde = {version="1.0.198" , features=["rc"] }
Expand Down
22 changes: 20 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use structures::{Player, GameObjectDerived, Renderable, Renderer, Cullable};
mod jinja_env;
use jinja_env::create_env;


/// A convenience function to create a directory if it doesn't exist, and do nothing if it does.
/// Also prints an error message if the directory creation fails.
fn create_dir_maybe(name: &str) {
Expand All @@ -34,6 +33,16 @@ fn create_dir_maybe(name: &str) {
}
}

// include these variables only in debug mode
/*
static INT_H_TEMPLATE:&str = include_str!("../templates/homeTemplate.html");
static INT_C_TEMPLATE:&str = include_str!("../templates/charTemplate.html");
static INT_CUL_TEMPLATE:&str = include_str!("../templates/cultureTemplate.html");
static INT_DYN_TEMPLATE:&str = include_str!("../templates/dynastyTemplate.html");
static INT_FAITH_TEMPLATE:&str = include_str!("../templates/faithTemplate.html");
static INT_TITLE_TEMPLATE:&str = include_str!("../templates/titleTemplate.html");
*/

/// Main function. This is the entry point of the program.
///
/// # Arguments
Expand All @@ -57,12 +66,15 @@ fn create_dir_maybe(name: &str) {
/// 5. Prints the time taken to parse the save file
///
fn main() {
env::set_var("RUST_BACKTRACE", "1");
if cfg!(debug_assertions) {
env::set_var("RUST_BACKTRACE", "1");
}
//Get the staring time
let start_time = SystemTime::now();
//User IO
let mut filename = String::new();
let args: Vec<String> = env::args().collect();
let mut use_internal = false;
if args.len() < 2{
stdout().write_all(b"Enter the filename: ").unwrap();
stdout().flush().unwrap();
Expand All @@ -72,6 +84,12 @@ fn main() {
}
else{
filename = args[1].clone();
// foreach argument above 1
for arg in args.iter().skip(2) {
if arg == "--internal" {
use_internal = true;
}
}
}
//initialize the save file
let save = SaveFile::new(filename.as_str()); // now we have an iterator we can work with that returns these large objects
Expand Down

0 comments on commit b100b1a

Please sign in to comment.