mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
0cdb065739
binary to mount at runtime, -c or DMS_SHELL_DIR overrides required to explicitly override embedded configuration
37 lines
883 B
Go
37 lines
883 B
Go
// Package shellembed carries the quickshell UI inside the dms binary and
|
|
// materializes it at runtime via dankgo/shellapp/shellfs, since quickshell
|
|
// needs a real filesystem path. Customization goes through -c /
|
|
// DMS_SHELL_DIR instead of editing the extraction.
|
|
package shellembed
|
|
|
|
import (
|
|
"io/fs"
|
|
"path"
|
|
|
|
"github.com/AvengeMedia/dankgo/shellapp/shellfs"
|
|
)
|
|
|
|
const (
|
|
distRoot = "dist"
|
|
shellEntry = "shell.qml"
|
|
)
|
|
|
|
// Available reports whether this binary was built with the embedded UI
|
|
// (the withshell build tag).
|
|
func Available() bool {
|
|
info, err := fs.Stat(distFS, path.Join(distRoot, shellEntry))
|
|
return err == nil && !info.IsDir()
|
|
}
|
|
|
|
func Extract(baseDir string) (string, error) {
|
|
sub, err := fs.Sub(distFS, distRoot)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return shellfs.Extract(sub, baseDir)
|
|
}
|
|
|
|
func Prune(baseDir, keep string) {
|
|
shellfs.Prune(baseDir, keep)
|
|
}
|