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

Added $isLinux to output CRLF instead of LF #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hallpass.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ if ($students.Count -ge 1) {

#No header file on the students.sd file.
$students | ConvertTo-CSV -Delimiter '|' -NoTypeInformation -UseQuotes AsNeeded | Select-Object -Skip 1 | Out-File -Path $PSScriptRoot\hallpass\students.sd -Force
if ($islinux) { (Get-Content -Raw -Path $PSScriptRoot/hallpass/students.sd) -replace '\n',"`r`n" | Set-Content -Path $PSScriptRoot/hallpass/students.sd }
$filesToZip.Add("hallpass\students.sd") | Out-Null


Expand Down Expand Up @@ -129,6 +130,7 @@ if ($includeGuardians) {
if ($guardians.Count -ge 1) {
#No header file on the students.sd file.
$guardians | ConvertTo-CSV -Delimiter '|' -NoTypeInformation -UseQuotes AsNeeded | Select-Object -Skip 1 | Out-File -Path $PSScriptRoot\hallpass\guardians.gd -Force
if ($islinux) { (Get-Content -Raw -Path $PSScriptRoot/hallpass/guardians.gd) -replace '\n',"`r`n" | Set-Content -Path $PSScriptRoot/hallpass/guardians.gd }
$filesToZip.Add("hallpass\guardians.gd") | Out-Null

} else {
Expand Down Expand Up @@ -167,7 +169,9 @@ if ($IncludeFaculty) {
$faculty = Import-CSV $PSScriptRoot\files\faculty.csv | Where-Object { $validFacultyIds -contains $PSItem.'employee id' }

$faculty | ConvertTo-CSV -Delimiter '|' -NoTypeInformation -UseQuotes AsNeeded | Select-Object -Skip 1 | Out-File -Path $PSScriptRoot\hallpass\faculty.fd -Force
if ($islinux) { (Get-Content -Raw -Path $PSScriptRoot/hallpass/faculty.fd) -replace '\n',"`r`n" | Set-Content -Path $PSScriptRoot/hallpass/faculty.fd }
$facultyLocations | ConvertTo-CSV -Delimiter '|' -NoTypeInformation -UseQuotes AsNeeded | Select-Object -Skip 1 | Out-File -Path $PSScriptRoot\hallpass\faculty.ld -Force
if ($islinux) { (Get-Content -Raw -Path $PSScriptRoot/hallpass/faculty.ld) -replace '\n',"`r`n" | Set-Content -Path $PSScriptRoot/hallpass/faculty.ld }

try {
Compress-Archive -Path ($authorizationFile,"hallpass\faculty.fd","hallpass\faculty.ld") -CompressionLevel Optimal -DestinationPath ".\hallpass\$($filename)f.zip" -Force
Expand Down