|
48 | 48 | [System.IO.DirectoryInfo] $ModuleOutputFolder |
49 | 49 | ) |
50 | 50 |
|
51 | | - # Get the path separator for the current OS |
52 | | - $pathSeparator = [System.IO.Path]::DirectorySeparatorChar |
| 51 | + $separators = [char[]]@([System.IO.Path]::DirectorySeparatorChar, [System.IO.Path]::AltDirectorySeparatorChar) |
53 | 52 |
|
54 | 53 | Set-GitHubLogGroup 'Build root module' { |
55 | 54 | $rootModuleFile = New-Item -Path $ModuleOutputFolder -Name "$ModuleName.psm1" -Force |
@@ -185,22 +184,21 @@ Write-Debug "[$scriptName] - [data] - Done" |
185 | 184 | ) |
186 | 185 |
|
187 | 186 | foreach ($scriptFolder in $scriptFoldersToProcess) { |
188 | | - $scriptFolder = Join-Path -Path $ModuleOutputFolder -ChildPath $scriptFolder |
189 | | - if (-not (Test-Path -Path $scriptFolder)) { |
| 187 | + $scriptFolderPath = Join-Path -Path $ModuleOutputFolder -ChildPath $scriptFolder |
| 188 | + if (-not (Test-Path -Path $scriptFolderPath)) { |
190 | 189 | continue |
191 | 190 | } |
192 | | - Add-ContentFromItem -Path $scriptFolder -RootModuleFilePath $rootModuleFile -RootPath $ModuleOutputFolder |
193 | | - Remove-Item -Path $scriptFolder -Force -Recurse |
| 191 | + Add-ContentFromItem -Path $scriptFolderPath -RootModuleFilePath $rootModuleFile -RootPath $ModuleOutputFolder |
| 192 | + Remove-Item -Path $scriptFolderPath -Force -Recurse |
194 | 193 | } |
195 | 194 | #endregion - Add content from subfolders |
196 | 195 |
|
197 | 196 | #region - Add content from *.ps1 files on module root |
198 | 197 | $files = $ModuleOutputFolder | Get-ChildItem -File -Force -Filter '*.ps1' | Sort-Object -Property FullName |
199 | 198 | foreach ($file in $files) { |
200 | | - $relativePath = $file.FullName -replace $ModuleOutputFolder, '' |
201 | | - $relativePath = $relativePath -replace $file.Extension, '' |
202 | | - $relativePath = $relativePath.TrimStart($pathSeparator) |
203 | | - $relativePath = $relativePath -split $pathSeparator | ForEach-Object { "[$_]" } |
| 199 | + $relativePath = [System.IO.Path]::GetRelativePath($ModuleOutputFolder, $file.FullName) |
| 200 | + $relativePath = [System.IO.Path]::ChangeExtension($relativePath, $null).TrimEnd('.') |
| 201 | + $relativePath = $relativePath.Split($separators, [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { "[$_]" } |
204 | 202 | $relativePath = $relativePath -join ' - ' |
205 | 203 |
|
206 | 204 | Add-Content -Path $rootModuleFile -Force -Value @" |
|
0 commit comments