pkg/environment: Remove exec related functions

This commit starts the migration to remove the environment package. It
introduced an abstraction that is not being used, and removing it makes
the code simpler to maintain.

This commit removes all 'exec' related package.
This commit is contained in:
Tom Wiesing 2023-03-02 11:03:33 +01:00
parent 066390e30d
commit 14bb7f1086
No known key found for this signature in database
6 changed files with 32 additions and 25 deletions

View file

@ -1,6 +1,7 @@
package config
import (
"os"
"path/filepath"
"github.com/FAU-CDI/wisski-distillery/internal/bootstrap"
@ -34,7 +35,7 @@ func (pcfg PathsConfig) ExecutablePath() string {
// UsingDistilleryExecutable checks if the current process is using the distillery executable
func (pcfg PathsConfig) UsingDistilleryExecutable(env environment.Environment) bool {
exe, err := env.Executable()
exe, err := os.Executable()
if err != nil {
return false
}
@ -44,7 +45,7 @@ func (pcfg PathsConfig) UsingDistilleryExecutable(env environment.Environment) b
// CurrentExecutable returns the path to the current executable being used.
// When it does not exist, falls back to the default executable.
func (pcfg PathsConfig) CurrentExecutable(env environment.Environment) string {
exe, err := env.Executable()
exe, err := os.Executable()
if err != nil || !fsx.IsFile(env, exe) {
return pcfg.ExecutablePath()
}