I just found this target in a FAKE build script generated by ProjectScaffold:
// Copies binaries from default VS location to expected bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
-- "src/**/*.shproj"
|> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f)
</> "bin/Release", "bin"
</> (System.IO.Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true))
)
My question: What does this strange </>
operator do?
(My internet search was not very successful.)
The operator </>
is an infix operator and combines two path segments into one complete path. In this aspect it is almost the same as the @@ operator. The </>
operator was created after the @@ operator because the @@ operator behaves strangely on UNIX-like systems when the second path starts with root.
Here is an example taken from the issue description on GitHub.
"src" @@ "/home/projects/something" returns "src/home/projects/something"
"src" </> "/home/projects/something" returns "/home/projects/something"
The operator is defined in EnvironmentHelper: https://fsharp.github.io/FAKE/apidocs/fake-environmenthelper.html
These links points to the problem description: https://github.com/fsharp/FAKE/issues/670, https://github.com/fsharp/FAKE/pull/695
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With