Skip to content

Commit

Permalink
Using @@ operator instead of Path.Combine.
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed May 11, 2010
1 parent b4e468e commit 540f8bc
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/app/FakeLib/DocuHelper.fs
Expand Up @@ -11,9 +11,9 @@ type DocuParams =

/// Docu default params
let DocuDefaults =
{ ToolPath = Path.Combine(Path.Combine(Path.Combine(currentDirectory,"tools"),"FAKE"),"docu.exe");
TemplatesPath = Path.Combine(currentDirectory,"templates");
OutputPath = Path.Combine(currentDirectory,"output") }
{ ToolPath = currentDirectory @@ "tools" @@ "FAKE" @@ "docu.exe";
TemplatesPath = currentDirectory @@ "templates";
OutputPath = currentDirectory @@ "output" }

let Docu setParams assembly =
traceStartTask "Docu" assembly
Expand Down
6 changes: 5 additions & 1 deletion src/app/FakeLib/EnvironmentHelper.fs
Expand Up @@ -2,14 +2,18 @@
module Fake.EnvironmentHelper

open System
open System.IO

type EnvironTarget = EnvironmentVariableTarget

/// Retrieves the EnvironmentVariable
let environVar = Environment.GetEnvironmentVariable

/// Gets the current directory
let currentDirectory = System.IO.Path.GetFullPath "."
let currentDirectory = Path.GetFullPath "."

/// Combines to path strings
let inline (@@) path1 path2 = Path.Combine(path1,path2)

/// Retrieves the EnvironmentVariable
let environVars x =
Expand Down
8 changes: 4 additions & 4 deletions src/app/FakeLib/FXCopHelper.fs
Expand Up @@ -58,7 +58,7 @@ let FxCopDefaults =
RuleLibraries = Seq.empty;
Rules = Seq.empty;
ConsoleXslFileName = String.Empty;
ReportFileName = Path.Combine(currentDirectory,"FXCopResults.html");
ReportFileName = currentDirectory @@ "FXCopResults.html";
OutputXslFileName = String.Empty;
PlatformDirectory = String.Empty;
ProjectFile = String.Empty;
Expand All @@ -68,7 +68,7 @@ let FxCopDefaults =
WorkingDir = currentDirectory;
Verbose = true;
FailOnError = FxCopyErrorLevel.DontFailBuild;
ToolPath = Path.Combine(ProgramFilesX86,"Microsoft FxCop 1.36\"") }
ToolPath = ProgramFilesX86 @@ "Microsoft FxCop 1.36" }

/// Run FxCop on a group of assemblies.
let FxCop setParams (assemblies: string seq) =
Expand All @@ -78,7 +78,7 @@ let FxCop setParams (assemblies: string seq) =
let param =
if param.ApplyOutXsl && param.OutputXslFileName = String.Empty then
{param with
OutputXslFileName = Path.Combine(Path.Combine(param.ToolPath, "Xml"),"FxCopReport.xsl") }
OutputXslFileName = param.ToolPath @@ "Xml" @@ "FxCopReport.xsl" }
else param

let commandLineCommands =
Expand All @@ -105,7 +105,7 @@ let FxCop setParams (assemblies: string seq) =
appendFormat "/p:\"{0}\" " param.ProjectFile

for item in param.RuleLibraries do
appendFormat "/r:\"{0}\" " (Path.Combine(Path.Combine(param.ToolPath, "Rules"), item))
appendFormat "/r:\"{0}\" " (param.ToolPath @@ "Rules" @@ item)

appendItems "/rid:{0} " param.Rules

Expand Down
8 changes: 4 additions & 4 deletions src/app/FakeLib/FileHelper.fs
Expand Up @@ -111,7 +111,7 @@ let CopyFileIntoSubFolder target file =
/// param file: The FileName
let CopyFile target file =
let fi = new FileInfo(file)
let targetName = Path.Combine(target, fi.Name)
let targetName = target @@ fi.Name
logVerbosefn "Copy %s to %s" file targetName
fi.CopyTo(targetName,true) |> ignore

Expand All @@ -128,7 +128,7 @@ let Rename target file = (new FileInfo(file)).MoveTo target
let SilentCopy target files =
files |> Seq.iter (fun file ->
let fi = new FileInfo(file)
let targetName = Path.Combine(target, fi.Name)
let targetName = target @@ fi.Name
let targetFI = new FileInfo(targetName)
if targetFI.Exists then
if fi.LastWriteTime > targetFI.LastWriteTime then
Expand Down Expand Up @@ -297,7 +297,7 @@ let rec copyRecursive (dir:DirectoryInfo) (outputDir:DirectoryInfo) overwrite =
dir.GetDirectories()
|> Seq.fold
(fun acc (d:DirectoryInfo) ->
let newDir = new DirectoryInfo(Path.Combine(outputDir.FullName,d.Name))
let newDir = new DirectoryInfo(outputDir.FullName @@ d.Name)
if not newDir.Exists then
newDir.Create()
copyRecursive d newDir overwrite @ acc)
Expand All @@ -306,7 +306,7 @@ let rec copyRecursive (dir:DirectoryInfo) (outputDir:DirectoryInfo) overwrite =
(dir.GetFiles()
|> Seq.map
(fun f ->
let newFileName = Path.Combine(outputDir.FullName, f.Name)
let newFileName = outputDir.FullName @@ f.Name
f.CopyTo(newFileName, overwrite) |> ignore
newFileName)
|> Seq.toList) @ files
Expand Down
16 changes: 8 additions & 8 deletions src/app/FakeLib/FileSet.fs
Expand Up @@ -38,7 +38,7 @@ let cleanPathBuilder (path:string) =
let cleanPath path = (cleanPathBuilder path).ToString()

let combinePath baseDirectory path =
Path.Combine(baseDirectory, cleanPath(path))
baseDirectory @@ cleanPath(path)
|> Path.GetFullPath


Expand Down Expand Up @@ -182,8 +182,8 @@ let parseSearchDirectoryAndPattern (baseDir:DirectoryInfo) originalPattern =
if Path.IsPathRooted s then
Path.GetFullPath s
else
// we also (correctly) get to this branch of code when s.Length == 0
Path.Combine(baseDir.FullName, s)
// we also (correctly) get to this branch of code when s.Length == 0
baseDir.FullName @@ s
|> Path.GetFullPath

// remove trailing directory separator character, fixes bug #1195736
Expand Down Expand Up @@ -226,11 +226,11 @@ let convertPatterns baseDir patterns =
Pattern = regexPattern}
:: regExPatterns,names
else
let exactName = Path.Combine(searchDirectory, regexPattern)
if names |> List.exists (fun e -> e = exactName) then
regExPatterns,names
let exactName = searchDirectory @@ regexPattern
if names |> List.exists ((=) exactName) then
regExPatterns,names
else
regExPatterns,exactName::names)
regExPatterns,exactName::names)
([],[])


Expand Down Expand Up @@ -322,7 +322,7 @@ let rec scanDirectory caseSensitive includeNames

// scan files
for fi in currentDirectoryInfo.GetFiles() do
let fileName = Path.Combine(path, fi.Name)
let fileName = path @@ fi.Name
if isPathIncluded fileName caseSensitive compareOptions includeNames includedPatterns excludeNames excludePatterns then
yield fileName

Expand Down
4 changes: 2 additions & 2 deletions src/app/FakeLib/HTMLHelpWorkShopHelper.fs
Expand Up @@ -19,5 +19,5 @@ let CompileHTMLHelpProject helpCompiler projectFile =

let name = fi.Name.Split('.').[0]
traceEndTask "HTMLHelpWorkshop" projectFile
[ Path.Combine(fi.Directory.FullName, sprintf "%s.chm" name)
Path.Combine(fi.Directory.FullName, sprintf "%s.hh" name)]
[ fi.Directory.FullName @@ sprintf "%s.chm" name
fi.Directory.FullName @@ sprintf "%s.hh" name]
2 changes: 1 addition & 1 deletion src/app/FakeLib/ILMergeHelper.fs
Expand Up @@ -11,7 +11,7 @@ type ILMergeParams =

/// ILMerge default params
let ILMergeDefaults : ILMergeParams =
{ ToolPath = Path.Combine(Path.Combine(Path.Combine(currentDirectory,"tools"),"ILMerge"),"ilmerge.exe");
{ ToolPath = currentDirectory @@ "tools" @@ "ILMerge" @@ "ilmerge.exe";
Version = "";
Libraries = []; }

Expand Down
4 changes: 2 additions & 2 deletions src/app/FakeLib/NCoverHelper.fs
Expand Up @@ -14,8 +14,8 @@ type NCoverParams =
/// NCover default params
let NCoverDefaults =
{ ProjectName = String.Empty;
ToolPath = Path.Combine(Path.Combine(ProgramFiles,"NCover"),"ncover.console.exe");
TestRunnerExe = Path.Combine(Path.Combine(Path.Combine(ProgramFiles,"NUnit"),"bin"),"nunit-console.exe");
ToolPath = ProgramFiles @@ "NCover" @@ "ncover.console.exe";
TestRunnerExe = ProgramFiles @@ "NUnit" @@ "bin" @@ "nunit-console.exe";
WorkingDir = currentDirectory}

/// Run NCover on a group of assemblies.
Expand Down
6 changes: 3 additions & 3 deletions src/app/FakeLib/NUnitHelper.fs
Expand Up @@ -47,9 +47,9 @@ let toolName = @"nunit-console.exe"
let NUnitDefaults =
{ IncludeCategory = null;
ExcludeCategory = null;
ToolPath = Path.Combine(Path.Combine(currentDirectory,"tools"),"Nunit");
ToolPath = currentDirectory @@ "tools" @@ "Nunit";
TestInNewThread = false;
OutputFile = Path.Combine(currentDirectory,"TestResult.xml");
OutputFile = currentDirectory @@ "TestResult.xml";
ErrorOutputFile = null;
WorkingDir = null;
Framework = null;
Expand Down Expand Up @@ -77,7 +77,7 @@ let NUnit setParams (assemblies: string seq) =
|> appendIfNotNull parameters.Framework "/framework:"
|> appendIfNotNull parameters.ErrorOutputFile "/err:"

let tool = Path.Combine(parameters.ToolPath, toolName)
let tool = parameters.ToolPath @@ toolName
let args = commandLineBuilder.ToString()
trace (tool + " " + args)
let result =
Expand Down
2 changes: 1 addition & 1 deletion src/app/FakeLib/ProcessHelper.fs
Expand Up @@ -76,7 +76,7 @@ let tryFindFile dirs file =
.Replace("[ProgramFilesX86]",ProgramFilesX86)
let dir = new DirectoryInfo(path')
if not dir.Exists then "" else
let fi = new FileInfo(Path.Combine(dir.FullName, file))
let fi = new FileInfo(dir.FullName @@ file)
if fi.Exists then fi.FullName else "")
|> Seq.filter ((<>) "")
if not (Seq.isEmpty files) then
Expand Down
11 changes: 5 additions & 6 deletions src/app/FakeLib/WiXHelper.fs
Expand Up @@ -49,16 +49,15 @@ open System
type WiXParams = { ToolDirectory: string;}

/// WiX default params
let WiXDefaults : WiXParams =
{ ToolDirectory = Path.Combine(Path.Combine(currentDirectory,"tools"),"Wix") }
let WiXDefaults : WiXParams = { ToolDirectory = currentDirectory @@ "tools" @@ "Wix" }

let Candle (parameters:WiXParams) wixScript =
traceStartTask "Candle" wixScript

let fi = new System.IO.FileInfo(wixScript)
let wixObj = Path.Combine(fi.Directory.FullName,sprintf @"%s.wixobj" fi.Name)
let fi = new FileInfo(wixScript)
let wixObj = fi.Directory.FullName @@ sprintf @"%s.wixobj" fi.Name

let tool = Path.Combine(parameters.ToolDirectory,"candle.exe")
let tool = parameters.ToolDirectory @@ "candle.exe"
let args =
sprintf "-out \"%s\" \"%s\" -ext WiXNetFxExtension"
wixObj
Expand All @@ -79,7 +78,7 @@ let Candle (parameters:WiXParams) wixScript =
let Light (parameters:WiXParams) outputFile wixObj =
traceStartTask "Light" wixObj

let tool = Path.Combine(parameters.ToolDirectory,"light.exe")
let tool = parameters.ToolDirectory @@ "light.exe"
let args =
sprintf "\"%s\" -spdb -dcl:high -out \"%s\" -ext WiXNetFxExtension -ext WixUIExtension.dll -ext WixUtilExtension.dll"
(wixObj |> FullName)
Expand Down
4 changes: 2 additions & 2 deletions src/app/FakeLib/XUnitHelper.fs
Expand Up @@ -18,7 +18,7 @@ type XUnitParams =

/// xUnit default params
let XUnitDefaults =
{ ToolPath = Path.Combine(Path.Combine(Path.Combine(currentDirectory,"tools"),"xUnit"),"xunit.console.exe");
{ ToolPath = currentDirectory @@ "tools" @@ "xUnit" @@ "xunit.console.exe";
ConfigFile = null;
HtmlOutput = false;
NUnitXmlOutput = false;
Expand All @@ -29,7 +29,7 @@ let XUnitDefaults =
OutputDir = null}

let ResourceStream toolPath xmlResourceName =
new FileStream(Path.Combine(toolPath,xmlResourceName), FileMode.Open, FileAccess.Read)
new FileStream(toolPath @@ xmlResourceName, FileMode.Open, FileAccess.Read)


let xUnit setParams assemblies =
Expand Down

0 comments on commit 540f8bc

Please sign in to comment.