diff --git a/Project.toml b/Project.toml index 53ca051f..6aa154c6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BinaryBuilderBase" uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e" authors = ["Elliot Saba "] -version = "0.6.4" +version = "0.6.5" [deps] CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193" diff --git a/src/Prefix.jl b/src/Prefix.jl index 7c5b909d..ba608dfb 100644 --- a/src/Prefix.jl +++ b/src/Prefix.jl @@ -109,12 +109,13 @@ function includedir(prefix::Prefix) end """ - logdir(prefix::Prefix) + logdir(prefix::Prefix; subdir::AbstractString="") -Returns the logs directory for the given `prefix`. +Returns the logs directory for the given `prefix`. If `subdir` is a non-empty string, that +directory it is appended to the logdir of the given `prefix`. """ -function logdir(prefix::Prefix) - return joinpath(prefix, "logs") +function logdir(prefix::Prefix; subdir::AbstractString="") + return strip_backslash(joinpath(prefix, "logs", subdir)) end """ diff --git a/src/utils.jl b/src/utils.jl index 2b5a5005..8a2147e5 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,7 +1,7 @@ # The functions in this file may not be used anywhere in this package but may # needed by different modules of BinaryBuilder.jl -with_logfile(f::Function, prefix::Prefix, name::String) = with_logfile(f, joinpath(logdir(prefix), name)) +with_logfile(f::Function, prefix::Prefix, name::String; subdir="") = with_logfile(f, joinpath(logdir(prefix; subdir), name)) function with_logfile(f::Function, logfile::String) mkpath(dirname(logfile)) diff --git a/test/prefix.jl b/test/prefix.jl index 2ffe62e1..bf99f951 100644 --- a/test/prefix.jl +++ b/test/prefix.jl @@ -32,6 +32,7 @@ using CodecZlib @test bindir(prefix) == joinpath(prefix, "bin") @test includedir(prefix) == joinpath(prefix, "include") @test logdir(prefix) == joinpath(prefix, "logs") + @test logdir(prefix; subdir="test") == joinpath(prefix, "logs", "test") end end