The problem is the way you are combining paths, you have to remove the \
at the beginning, just write @"bin\Debug"
Also you can combine both maps into one, since map f |> map g
is equivalent to map (f |> g)
and instead of map
+ concat
you can use collect
.
Here's your original code with these corrections:
open System
open System.IO
module FileUtils =
type BuildConfiguration = {Name:string; Directory:string}
let DebugBuildConfiguration = {Name = "Debug"; Directory = @"bin\Debug"}
let ReleaseBuildConfiguration = {Name = "Release"; Directory = @"bin\Release"}
let StagingBuildConfiguration = {Name = "Staging"; Directory = @"bin\Staging"}
let codeDir = @"C:\source-control\s4sold\src"
let sourceDirs = [| "co"; "lo"; "mo"; "po"; "pr"; "pro"; "re"; "ro" |]
let allSourceDirs = sourceDirs
|> Array.collect (fun i -> Path.Combine(codeDir, i) |> Directory.GetDirectories)
allSourceDirs |> printf "%A"
List.ofArray allSourceDirs
|> List.map (fun i -> Path.Combine(i, buildConfiguration.Directory))
// |> Seq.toArray