运算符 </> 在 FAKE 构建脚本中做什么?
What does the operator </> do in FAKE build scripts?
我刚刚在 ProjectScaffold 生成的 FAKE 构建脚本中发现了这个目标:
// 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))
)
我的问题:这个奇怪的 </>
运算符有什么作用?
(我的网络搜索不是很成功。)
运算符</>
是一个中缀运算符,它将两个路径段组合成一个完整的路径。在这方面它几乎与@@ 运算符相同。 </>
运算符是在 @@ 运算符之后创建的,因为当第二条路径以 root 开头时,@@ 运算符在 UNIX-like 系统上的行为很奇怪。
这是从 GitHub 上的问题描述中摘录的示例。
"src" @@ "/home/projects/something" returns "src/home/projects/something"
"src" </> "/home/projects/something" returns "/home/projects/something"
运算符在EnvironmentHelper中定义:
https://fsharp.github.io/FAKE/apidocs/fake-environmenthelper.html
这些链接指向问题描述:
https://github.com/fsharp/FAKE/issues/670,
https://github.com/fsharp/FAKE/pull/695
我刚刚在 ProjectScaffold 生成的 FAKE 构建脚本中发现了这个目标:
// 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))
)
我的问题:这个奇怪的 </>
运算符有什么作用?
(我的网络搜索不是很成功。)
运算符</>
是一个中缀运算符,它将两个路径段组合成一个完整的路径。在这方面它几乎与@@ 运算符相同。 </>
运算符是在 @@ 运算符之后创建的,因为当第二条路径以 root 开头时,@@ 运算符在 UNIX-like 系统上的行为很奇怪。
这是从 GitHub 上的问题描述中摘录的示例。
"src" @@ "/home/projects/something" returns "src/home/projects/something"
"src" </> "/home/projects/something" returns "/home/projects/something"
运算符在EnvironmentHelper中定义: https://fsharp.github.io/FAKE/apidocs/fake-environmenthelper.html
这些链接指向问题描述: https://github.com/fsharp/FAKE/issues/670, https://github.com/fsharp/FAKE/pull/695