Skip to content

Commit

Permalink
Merge pull request #20 from davidhayesbc/master
Browse files Browse the repository at this point in the history
Fix for Issue #19
  • Loading branch information
lipkau committed Aug 16, 2015
2 parents 6f64e71 + 8acaf6f commit 02bf5fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Functions/Get-IniContent.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Function Get-IniContent {
Set-StrictMode -Version Latest
Function Get-IniContent {
<#
.Synopsis
Gets the content of an INI file
Expand Down Expand Up @@ -83,6 +84,7 @@
Write-Verbose "$($MyInvocation.MyCommand.Name):: Processing file: $Filepath"

$ini = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)
$commentCount = 0
switch -regex -file $FilePath
{
"^\[(.+)\]$" # Section
Expand All @@ -96,7 +98,7 @@
{
if (!$IgnoreComments)
{
if (!($section))
if (!(test-path "variable:section"))
{
$section = "_"
$ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)
Expand All @@ -110,7 +112,7 @@
}
"(.+?)\s*=\s*(.*)" # Key
{
if (!($section))
if (!(test-path "variable:section"))
{
$section = "_"
$ini[$section] = New-Object System.Collections.Specialized.OrderedDictionary([System.StringComparer]::OrdinalIgnoreCase)
Expand Down
3 changes: 2 additions & 1 deletion Functions/Out-IniFile.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Function Out-IniFile {
Set-StrictMode -Version Latest
Function Out-IniFile {
<#
.Synopsis
Write hash content to INI file
Expand Down

0 comments on commit 02bf5fd

Please sign in to comment.