39 lines
1.0 KiB
PowerShell
39 lines
1.0 KiB
PowerShell
# Opens hie_parser configuration file in the default editor, creating file
|
|
# if necessary.
|
|
|
|
$config_filepath = Join-Path -Path "$env:USERPROFILE" -ChildPath "\AppData\Local\smileyface-ut4\hub_config.ini"
|
|
|
|
$dir_path = Split-Path -Path "$config_filepath"
|
|
|
|
|
|
# Create config directory if necessary:
|
|
if (!(Test-Path "$dir_path" -Type Container))
|
|
{
|
|
Write-Host "Creating config directory: $dir_path"
|
|
New-Item -ItemType "directory" -Path "$dir_path" > $null
|
|
Write-Host
|
|
}
|
|
|
|
# Create config.ini if necessary:
|
|
if (!(Test-Path "$config_filepath" -Type Leaf))
|
|
{
|
|
Write-Host "Creating new config.ini: $config_filepath"
|
|
New-Item -Path "$config_filepath" > $null
|
|
Set-Content "$config_filepath" @"
|
|
|
|
|
|
"@
|
|
}
|
|
|
|
# Open config.ini in favorite text editor:
|
|
Write-Host "Opening covid_parser configuration in your system-default editor"
|
|
Write-Host "Configuration file: $config_filepath"
|
|
Invoke-Item "$config_filepath"
|
|
|
|
# Leave terminal open after done:
|
|
if ($Host.Name -eq "ConsoleHost")
|
|
{
|
|
Write-Host "Done."
|
|
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
|
|
}
|