Get alternative input file via env variable instead
This commit is contained in:
parent
731d7f5e33
commit
b734f0c5af
|
@ -1,13 +1,7 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
pub fn read_file(day: usize) -> String {
|
pub fn read_file(day: usize) -> String {
|
||||||
std::fs::read_to_string(
|
std::fs::read_to_string(env::var("AOC_INPUT").unwrap_or_else(|_| format!("inputs/day{:0>2}", day))).unwrap()
|
||||||
env::args()
|
|
||||||
.nth(1)
|
|
||||||
.filter(|n| n != "--bench")
|
|
||||||
.unwrap_or_else(|| format!("inputs/day{:0>2}", day)),
|
|
||||||
)
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user