mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-23 21:42:23 -05:00
Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.1.8 to 2.2.2. - [Release notes](https://github.com/gookit/config/releases) - [Commits](https://github.com/gookit/config/compare/v2.1.8...v2.2.2) --- updated-dependencies: - dependency-name: github.com/gookit/config/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
48 lines
822 B
Go
48 lines
822 B
Go
// Package sysutil provide some system util functions. eg: sysenv, exec, user, process
|
|
package sysutil
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// Workdir get
|
|
func Workdir() string {
|
|
dir, _ := os.Getwd()
|
|
return dir
|
|
}
|
|
|
|
// BinDir get
|
|
func BinDir() string {
|
|
return filepath.Dir(os.Args[0])
|
|
}
|
|
|
|
// BinName get
|
|
func BinName() string {
|
|
return filepath.Base(os.Args[0])
|
|
}
|
|
|
|
// BinFile get
|
|
func BinFile() string {
|
|
return os.Args[0]
|
|
}
|
|
|
|
// Open file or url address
|
|
func Open(fileOrURL string) error {
|
|
return OpenURL(fileOrURL)
|
|
}
|
|
|
|
// OpenBrowser file or url address
|
|
func OpenBrowser(fileOrURL string) error {
|
|
return OpenURL(fileOrURL)
|
|
}
|
|
|
|
// OpenFile opens new browser window for the file path.
|
|
func OpenFile(path string) error {
|
|
fpath, err := filepath.Abs(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return OpenURL("file://" + fpath)
|
|
}
|