@@ -18,11 +18,6 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt};
18
18
/// When running automated tests, you may wish to set `force_run` to the result
19
19
/// of an environment variable check that you'll use when testing.
20
20
///
21
- /// This function expects to be run in the context of `.perseus/`, or any
22
- /// directory in which a folder `cache/` is available. If you're using Perseus
23
- /// without the CLI and you don't want that directory to exist, you shouldn't
24
- /// use this function.
25
- ///
26
21
/// # Panics
27
22
/// If this filesystem operations fail, this function will panic. It can't
28
23
/// return a graceful error since it's expected to return the type you
54
49
// In production, we'll just run the function directly
55
50
if cfg ! ( debug_assertions) {
56
51
// Check if the cache file exists
57
- let filename = format ! ( "cache/{}.json" , & name) ;
52
+ let filename = format ! ( "dist/ cache/{}.json" , & name) ;
58
53
match File :: open ( & filename) . await {
59
54
Ok ( mut file) => {
60
55
if force_run {
@@ -129,7 +124,7 @@ where
129
124
}
130
125
Err ( err) if err. kind ( ) == std:: io:: ErrorKind :: NotFound => {
131
126
// The file doesn't exist yet, create the parent cache directory
132
- create_dir_all ( "cache" )
127
+ create_dir_all ( "dist/ cache" )
133
128
. await
134
129
. unwrap_or_else ( |err| panic ! ( "couldn't create cache directory: {}" , err) ) ;
135
130
// We have no cache, so we'll have to run the function
0 commit comments