Closed michaelPf85 closed 5 years ago
Dear Michael
When you rename the parameter from $Path to $FilePath, you bring in a breaking change.
To prevent this, please add the attribute [Alias("Path")]
to the parameter $FilePath.
Best Regards Elia
Hello Elia
Thank you for your feedback. I thought it was only some internal API and would not break anything, but I was obviously mistaken.
I've added the Alias as you suggested.
Best regards Michael
Hello @lipkau ,
I renamed Path into FilePath because I didn't know of another way to make the calls with "@parameters" work. Add-Content takes a "Path" parameter but Out-File takes a "File-Path" parameter. If you have another idea I'll change to whatever works best.
Regarding the Strict mode it's a mistake when I edited my last commit, I'm fixing this.
As an aside re Set-StrictMode -Version Latest
: I suggest avoiding it in production code - see https://github.com/MicrosoftDocs/PowerShell-Docs/issues/4042
thank you for the input, @mklement0
I am aware of how much harder Set-StrictMode -Version Latest
makes things.
I will remove it, but not in the context of this PR.
We met some random exceptions while using PsIni. Googling for a while, I found that many people have these exceptions with Add-Content and Set-Content. Replacing it with piping the string into Out-File -Append, the exception does not appear again.
Typical exception :