Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easy to copy by keeping relative paths (CopyWithRelativePath). #1937

Closed
matthid opened this issue May 18, 2018 · 1 comment
Closed

Comments

@matthid
Copy link
Member

matthid commented May 18, 2018

Description

It should be easy (or the default rather) to copy a globbing result to another directory. This is currently a bit painful (or I have not found the correct API):

let CopyWithRelativePath targetDir (files:IGlobbingPattern) =
  let baseFull = (Path.GetFullPath files.BaseDirectory).TrimEnd [|'/';'\\'|]
  for item in files do
    let info = FileInfo.ofPath item
    let itemSpec =
      // first get relative path from the globbing
      let relative = (info.FullName.Substring (baseFull.Length+1))
      relative
    let parent = Path.GetDirectoryName (targetDir</>itemSpec)
    Directory.ensure parent
    File.Copy(item, targetDir</>itemSpec, true)

!! "My*Glob*.exe"
|> GlobbingPattern.setBaseDir ("baseDir")
|> CopyWithRelativePath "targetDir"

Known Workaround

Copy code to build-script.

@matthid
Copy link
Member Author

matthid commented May 20, 2018

fixed with rc015

@matthid matthid closed this as completed May 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant