@@ -5,25 +5,18 @@ use std::env;
5
5
use std:: ffi:: OsStr ;
6
6
use std:: path:: { Path , PathBuf } ;
7
7
8
- fn xdg_dir ( ) -> Result < xdg:: BaseDirectories > {
9
- let afl_rustc_version = afl_rustc_version ( ) ?;
10
- let prefix = Path :: new ( "afl.rs" )
11
- . join ( afl_rustc_version)
12
- . join ( pkg_version ( ) ) ;
13
- Ok ( xdg:: BaseDirectories :: with_prefix ( prefix) )
8
+ fn xdg_base_dir ( ) -> xdg:: BaseDirectories {
9
+ xdg:: BaseDirectories :: with_prefix ( "afl.rs" )
14
10
}
15
11
16
12
fn data_dir ( dir_name : & str ) -> Result < PathBuf > {
17
- // For docs.rs builds, use OUT_DIR.
18
- // For other cases, use a XDG data directory.
19
- // It is necessary to use OUT_DIR for docs.rs builds,
20
- // as that is the only place where we can write to.
21
- // The Cargo documentation recommends that build scripts
22
- // place their generated files at OUT_DIR too, but we
23
- // don't change that for now for normal builds.
24
- // smoelius: AFL++ is no longer built on docs.rs.
25
- let xdg_dir = xdg_dir ( ) ?;
26
- xdg_dir. create_data_directory ( dir_name) . map_err ( Into :: into)
13
+ let afl_rustc_version = afl_rustc_version ( ) ?;
14
+ let subdir = PathBuf :: from ( afl_rustc_version)
15
+ . join ( pkg_version ( ) )
16
+ . join ( dir_name) ;
17
+ xdg_base_dir ( )
18
+ . create_data_directory ( subdir)
19
+ . map_err ( Into :: into)
27
20
}
28
21
29
22
const SHORT_COMMIT_HASH_LEN : usize = 7 ;
0 commit comments