File tree 3 files changed +7
-1
lines changed
3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change
1
+ [workspace ]
2
+ members = [ " example/*" , " exercise/*" ]
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ fn get_puzzle(filename: &str) -> Result<Puzzle> {
12
12
13
13
fn main ( ) -> Result < ( ) > {
14
14
env_logger:: init ( ) ;
15
- let puzzle = match get_puzzle ( "puzzle.dat" ) . context ( "Couldn't get the first puzzle" ) {
15
+ // This gets the absolute path to the puzzle.dat file in examples/puzzle_game no matter what
16
+ // directory you are in when you run the `cargo run` command.
17
+ let puzzle_file_path = & format ! ( "{}/{}" , env!( "CARGO_MANIFEST_DIR" ) , "puzzle.dat" ) ;
18
+ let puzzle = match get_puzzle ( puzzle_file_path) . context ( "Couldn't get the first puzzle" ) {
16
19
Ok ( p) => p,
17
20
Err ( _) => Puzzle :: new ( ) ,
18
21
} ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ impl Puzzle {
29
29
}
30
30
/// Load a puzzle from a file
31
31
pub fn from_file ( _fh : File ) -> Result < Self , PuzzleError > {
32
+ println ! ( "HERE" ) ;
32
33
error ! ( "This file is missing a piece!" ) ;
33
34
Err ( PuzzleError :: MissingPiece )
34
35
}
You can’t perform that action at this time.
0 commit comments