From 137934753aa5175fb73fa4e2f9e5f0c8c93d8800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Pi=C4=85tek?= Date: Mon, 7 Nov 2016 23:39:10 +0100 Subject: [PATCH] Add support for relative paths --- src/GenerateReport.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/GenerateReport.ps1 b/src/GenerateReport.ps1 index 9c64c05..d185f5e 100644 --- a/src/GenerateReport.ps1 +++ b/src/GenerateReport.ps1 @@ -2,7 +2,7 @@ param( $CheckoutDir, [Parameter(Mandatory=$true)][ValidateSet('SVN','Git')]$VCS, - [string[]]$DirToExclude + [string[]]$DirToExclude ) $scriptPath = if($PSScriptRoot -eq $null){"."} else {$PSScriptRoot} @@ -32,7 +32,7 @@ function Get-FilesLOC Remove-Item $OutFilePath -ErrorAction SilentlyContinue $excludeParam = if ($DirToExclude){"--exclude-dir=$($DirToExclude -join ',')"}else {$null} Write-Verbose "Exclude $excludeParam" - & $clocExePath --by-file --csv --skip-uniqueness $excludeParam --out="$OutFilePath" $CheckoutDir | Write-Verbose + & $clocExePath --by-file --csv --skip-uniqueness $excludeParam --out="$OutFilePath" (Get-Item $CheckoutDir).FullName | Write-Verbose if(-not(Test-Path $OutFilePath)) { $PSCmdlet.ThrowTerminatingError("Cannot create LOC statistics file") @@ -114,7 +114,8 @@ function Bundle-Report{ [CmdletBinding()] Param($ClocDataFile, $SvnLogFile, $OutDataFile) Write-Verbose "Start bundling report" - $cleanCheckoutDir = $CheckoutDir -replace "\\","/" + $cleanCheckoutDir = ((Get-Item $CheckoutDir).FullName) -replace "\\","/" + Write-Verbose "Checkout dir: $cleanCheckoutDir" $vcsModulePath = Get-VcsModulePath & "$scriptPath\CodeTopologyBuilder.exe" $cleanCheckoutDir $vcsModulePath $SvnLogFile $ClocDataFile $OutDataFile Write-Verbose "Svn module: $vcsModulePath" @@ -196,4 +197,4 @@ switch($VCS) } Bundle-Report -ClocDataFile "$tmpDir\cloc.csv" -SvnLogFile "$tmpDir\svnlogfile.xml" -OutDataFile "$tmpDir\result.json" -Remove-Item $tmpDir -Recurse -Force +Remove-Item $tmpDir -Recurse -Force \ No newline at end of file