Compare commits

...

2 Commits

Author SHA1 Message Date
Joey Pollack 7150eb75b4 Beginning foundations - data loading 2 years ago
Joey Pollack 95c7358a79 Project start 2 years ago

3
.gitignore vendored

@ -14,3 +14,6 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information # MSVC Windows builds of rustc generate these, which store debugging information
*.pdb *.pdb
# SECRETS
secrets/

@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
".\\Cargo.toml"
]
}

@ -0,0 +1,9 @@
[package]
name = "spekkio"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
poise = "0.5.5"

@ -0,0 +1,20 @@
use std::{io::prelude::*, fs::File, path::Path };
pub fn load_token(file_name: &str) -> String
{
let mut file = match File::open(Path::new(file_name))
{
Ok(file) => file,
Err(why) => panic!("Could not open token file {}: {}", Path::new(file_name).display(), why),
};
let mut s = String::new();
let token = match file.read_to_string(&mut s)
{
Err(why) => panic!("couldn't read {}: {}", Path::new(file_name).display(), why),
Ok(_) => s,
};
token
}

@ -0,0 +1,10 @@
mod commands;
mod data_loader;
fn main()
{
let token = data_loader::load_token("secrets/test.txt");
println!("test data: {}", token);
}