diff --git a/src/Config/Loader.psm1 b/src/Config/Loader.psm1 index 1868e42..3de600a 100644 --- a/src/Config/Loader.psm1 +++ b/src/Config/Loader.psm1 @@ -6,14 +6,16 @@ Class Loader { [Hashtable] $Instances = @{} [Array] $Services - [String] $Version = '0.4' + [String] $Version = '0.5' + [String] $Path Loader() { # Get the root path $RootPath = (Get-Item $PSScriptRoot).Parent.Parent.FullName + $This.Path = $RootPath +'\config.json' # Load of the configuration - $Config = Get-Content ($RootPath +'\config.json') -Raw | ConvertFrom-JSON + $Config = Get-Content $This.Path -Raw | ConvertFrom-JSON # Saving the configuration in the current class $This.Services = $Config.Services $This.SetInstances($Config.Instances) diff --git a/src/Controller/AppController.psm1 b/src/Controller/AppController.psm1 index 25f2d5e..c5fa6cb 100644 --- a/src/Controller/AppController.psm1 +++ b/src/Controller/AppController.psm1 @@ -24,7 +24,7 @@ Class AppController '^config$' { # Opening config.yaml with the default editor [Console]::Write('Opening config.json...') - Invoke-Item 'config.json' + Invoke-Item $Config.Path } '^help$' { # Display the command list diff --git a/src/Controller/ConfigController.psm1 b/src/Controller/ConfigController.psm1 index 27aa4bc..5644cef 100644 --- a/src/Controller/ConfigController.psm1 +++ b/src/Controller/ConfigController.psm1 @@ -2,7 +2,7 @@ Class ConfigController { Static CheckConfigurationFile() { - $ConfigFile = 'config.json' + $ConfigFile = (Get-Item $PSScriptRoot).Parent.Parent.FullName +'\config.json' # Checking if the configuration file if ((Test-Path -Path $ConfigFile) -eq $False) { Throw 'The configuration file ''config.json'' has not been found, please reinstall the application' diff --git a/wsl-switch.json b/wsl-switch.json index 242e89d..51c0f11 100644 --- a/wsl-switch.json +++ b/wsl-switch.json @@ -1,10 +1,16 @@ { - "version": "0.4", + "version": "0.5", "description": "Switch WSL service activation from an host to another", "homepage": "https://github.com/Nyuwb/wsl-switch/", "license": "MIT license", - "url": "https://github.com/Nyuwb/wsl-switch/releases/download/v0.4/wsl-switch-v0.4.zip", - "hash": "b6fe2f872092c234d9b388b9f4cfe245443cb69515b1148e61ced2105fa1889e", + "url": "https://github.com/Nyuwb/wsl-switch/releases/download/v0.5/wsl-switch-v0.5.zip", + "hash": "83497a31cce3555b828cc7bd47f503414eefd4147f87b10acf24a525a5b2ed18", "bin": "wsl-switch.ps1", - "persist": "config.json" -} + "persist": [ + "config.json" + ], + "checkver": "github", + "autoupdate": { + "url": "https://github.com/Nyuwb/wsl-switch/archive/refs/tags/v$version.zip" + } +} \ No newline at end of file