Skip to content

Commit

Permalink
create missing dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPicklePinosaur committed Sep 25, 2024
1 parent 0023e6b commit 90a8df2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drive/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ foreground_sleep_ms 2 // number of milliseconds to sleep each frame. Try 10 to c

background_sleep_ms 10 // number of milliseconds to sleep each frame when running in the background

sessions 302 // number of times program has been run
sessions 304 // number of times program has been run

// (scancode) hold this key down and left-click to simulate right-click
rmb_key 0 // 0 for none 226 for LALT
Expand Down
19 changes: 18 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::{
collections::HashMap,
ffi::OsStr,
fs::{read_dir, read_to_string, File, OpenOptions},
fs::{create_dir_all, read_dir, read_to_string, File, OpenOptions},
io::{BufRead, BufReader, Read, Write},
ops::ControlFlow,
path::{Path, PathBuf},
Expand Down Expand Up @@ -30,6 +30,19 @@ fn parse_metadata(path: &Path) -> anyhow::Result<String> {
Ok(serialized)
}

fn create_dirs() -> anyhow::Result<()> {
create_dir_all(EXE_DIR.as_path())?;
create_dir_all(CART_DIR.as_path())?;
create_dir_all(GAMES_DIR.as_path())?;
create_dir_all(MUSIC_DIR.as_path())?;
create_dir_all(LABEL_DIR.as_path())?;
create_dir_all(METADATA_DIR.as_path())?;
create_dir_all(BBS_CART_DIR.as_path())?;
create_dir_all(RAW_SCREENSHOT_PATH)?;
create_dir_all(SCREENSHOT_PATH)?;
Ok(())
}

fn main() {
// set up logger
let crate_name = env!("CARGO_PKG_NAME");
Expand All @@ -43,6 +56,10 @@ fn main() {
screenshot_watcher();
});

if let Err(e) = create_dirs() {
warn!("failed to create directories: {e:?}");
}

// launch pico8 binary
let pico8_bin_override = std::env::var("PICO8_BINARY");

Expand Down

0 comments on commit 90a8df2

Please sign in to comment.