-
Notifications
You must be signed in to change notification settings - Fork 587
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
Fix #992 test failure when space in temp path. #1076
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,11 +78,22 @@ let cscExe toolPath (srcFiles : string list) (opts : string list) : int = | |
/// Target = ... | ||
/// ... }) | ||
let csc (setParams : CscParams -> CscParams) (inputFiles : string list) : int = | ||
let inputFiles = inputFiles |> Seq.toList | ||
// Helper to quote a path with spaces in it, if not already quoted. See https://github.com/fsharp/FAKE/issues/992 | ||
let ensureTrimQuotedPath (path : string) = | ||
// Sensitive to being backwards compatible with people that are using | ||
// Csc AND quoting their paths. Only quote if space in path and quotes not detected. | ||
// MAYBE this should go in the FileSystemHelper module? | ||
let path = path.Trim() | ||
if path.Contains(" ") then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking this should probably be trimmed. Currently we could double quote a path that is already quoted, but book ended with whitespace. |
||
if (path.StartsWith("\"") && path.EndsWith("\"")) || (path.StartsWith("'") && path.EndsWith("'")) then path | ||
else sprintf "\"%s\"" path | ||
else path | ||
|
||
let inputFiles = inputFiles |> Seq.map ensureTrimQuotedPath |> Seq.toList | ||
let taskDesc = inputFiles |> separated ", " | ||
let cscParams = setParams CscParams.Default | ||
|
||
let output = if cscParams.Output <> "" then [sprintf "/out:%s" cscParams.Output] else [] | ||
let output = if cscParams.Output <> "" then [sprintf "/out:%s" (ensureTrimQuotedPath cscParams.Output)] else [] | ||
let target = | ||
match cscParams.Target with | ||
| Exe -> [ "/target:exe" ] | ||
|
@@ -98,7 +109,7 @@ let csc (setParams : CscParams -> CscParams) (inputFiles : string list) : int = | |
| AnyCpu -> [ "/platform:anycpu" ] | ||
let references = | ||
cscParams.References | ||
|> List.map (fun r -> sprintf "/reference:%s" r) | ||
|> List.map (ensureTrimQuotedPath >> (sprintf "/reference:%s")) | ||
let debug = if cscParams.Debug then [ "/debug" ] else [] | ||
let argList = | ||
output @ target @ platform @ references @ debug @ cscParams.OtherParams | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this in one of the other helpers? Maybe we already have something similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not see a helper for this. My search for ""%s"" yielded a handful of other places doing this. I will add a helper function
trimAndEnsureQuotedIfRequired
to theFileSystemHelper.fs
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx.
On Jan 16, 2016 2:49 PM, "Ben Taylor" [email protected] wrote:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm hesitant about making this a general function. Digging around, this is not as simple as it first appears. Might be better to leave it local to the
csc
function. It is already local in the other places.