functions/LoadProfile.ps1
function LoadProfile { if(Test-Path $Script:ProfilePath) { $obj = Get-Content $Script:ProfilePath | ConvertFrom-Json if(-not (Get-Member -InputObject $obj -Name Path)) { return ($obj | Add-Member -NotePropertyName Path -NotePropertyValue ([CmlLib.Core.MinecraftPath]::new().BasePath) -PassThru) } else { return $obj } } else { [PSCustomObject]@{ Name = "" Version = "" Path = [CmlLib.Core.MinecraftPath]::new().BasePath } } } |