mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-08 06:28:27 -04:00
core: some fixes for embedded distribution, VERSION file, matugen
scripts, and embed scripts
This commit is contained in:
@@ -7,13 +7,15 @@ package shellembed
|
||||
import (
|
||||
"io/fs"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/AvengeMedia/dankgo/shellapp/shellfs"
|
||||
)
|
||||
|
||||
const (
|
||||
distRoot = "dist"
|
||||
shellEntry = "shell.qml"
|
||||
distRoot = "dist"
|
||||
shellEntry = "shell.qml"
|
||||
versionFile = "VERSION"
|
||||
)
|
||||
|
||||
// Available reports whether this binary was built with the embedded UI
|
||||
@@ -23,6 +25,15 @@ func Available() bool {
|
||||
return err == nil && !info.IsDir()
|
||||
}
|
||||
|
||||
// Version reports the embedded UI's VERSION, empty when unavailable.
|
||||
func Version() string {
|
||||
data, err := fs.ReadFile(distFS, path.Join(distRoot, versionFile))
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(string(data))
|
||||
}
|
||||
|
||||
func Extract(baseDir string) (string, error) {
|
||||
sub, err := fs.Sub(distFS, distRoot)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user