Skip to content

Commit 90a8df2

Browse files
create missing dirs
1 parent 0023e6b commit 90a8df2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

drive/config.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ foreground_sleep_ms 2 // number of milliseconds to sleep each frame. Try 10 to c
3030

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

33-
sessions 302 // number of times program has been run
33+
sessions 304 // number of times program has been run
3434

3535
// (scancode) hold this key down and left-click to simulate right-click
3636
rmb_key 0 // 0 for none 226 for LALT

src/main.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use std::{
33
collections::HashMap,
44
ffi::OsStr,
5-
fs::{read_dir, read_to_string, File, OpenOptions},
5+
fs::{create_dir_all, read_dir, read_to_string, File, OpenOptions},
66
io::{BufRead, BufReader, Read, Write},
77
ops::ControlFlow,
88
path::{Path, PathBuf},
@@ -30,6 +30,19 @@ fn parse_metadata(path: &Path) -> anyhow::Result<String> {
3030
Ok(serialized)
3131
}
3232

33+
fn create_dirs() -> anyhow::Result<()> {
34+
create_dir_all(EXE_DIR.as_path())?;
35+
create_dir_all(CART_DIR.as_path())?;
36+
create_dir_all(GAMES_DIR.as_path())?;
37+
create_dir_all(MUSIC_DIR.as_path())?;
38+
create_dir_all(LABEL_DIR.as_path())?;
39+
create_dir_all(METADATA_DIR.as_path())?;
40+
create_dir_all(BBS_CART_DIR.as_path())?;
41+
create_dir_all(RAW_SCREENSHOT_PATH)?;
42+
create_dir_all(SCREENSHOT_PATH)?;
43+
Ok(())
44+
}
45+
3346
fn main() {
3447
// set up logger
3548
let crate_name = env!("CARGO_PKG_NAME");
@@ -43,6 +56,10 @@ fn main() {
4356
screenshot_watcher();
4457
});
4558

59+
if let Err(e) = create_dirs() {
60+
warn!("failed to create directories: {e:?}");
61+
}
62+
4663
// launch pico8 binary
4764
let pico8_bin_override = std::env::var("PICO8_BINARY");
4865

0 commit comments

Comments
 (0)