Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cargo-afl/AFLplusplus
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion afl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "afl"
version = "0.15.23"
version = "0.16.0-rc.1"
readme = "README.md"
license = "Apache-2.0"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion cargo-afl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-afl"
version = "0.15.23"
version = "0.16.0-rc.1"
readme = "README.md"
license = "Apache-2.0"
authors = [
Expand Down
20 changes: 18 additions & 2 deletions cargo-afl/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use std::env;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};

fn xdg_base_dir() -> xdg::BaseDirectories {
/// Return the [`xdg::BaseDirectories`] used by afl.rs
///
/// This function is public only for tests. Non-test code should use [`data_dir`], etc.
pub fn xdg_base_dir() -> xdg::BaseDirectories {
xdg::BaseDirectories::with_prefix("afl.rs")
}

Expand Down Expand Up @@ -55,7 +58,20 @@ pub fn object_file_path() -> Result<PathBuf> {
afl_llvm_dir().map(|path| path.join("libafl-llvm-rt.o"))
}

pub fn plugins_available() -> Result<bool> {
pub fn aflplusplus_dir() -> Result<PathBuf> {
aflplusplus_dir_from_base_dir(&xdg_base_dir())
}

/// Construct the AFLplusplus directory from [`xdg::BaseDirectories`]
///
/// This function exists only for tests. Non-test code should use [`aflplusplus_dir`].
pub fn aflplusplus_dir_from_base_dir(base_dir: &xdg::BaseDirectories) -> Result<PathBuf> {
base_dir
.create_data_directory("AFLplusplus")
.map_err(Into::into)
}

pub fn plugins_installed() -> Result<bool> {
let afl_llvm_dir = afl_llvm_dir()?;
for result in afl_llvm_dir
.read_dir()
Expand Down
Loading
Loading