Files
w3cjandClaude Opus 5.5 851e39ef86 build: embed devvm's files in its binary
devvm is one file: assets/ (base.yaml, layers/, features/,
shared-tools/, guest/, oci/, smolvm/) is embedded as assets.FS, which
cli passes to every constructor; backends, the builder, the shared
tools, the proxy and Ubuntu's key check read it as an fs.FS. Scripts
reach VMs on stdin (backend.Script carries their contents). What needs
a path (limactl create's base.yaml, oci/ mounted into the conversion
VM, the proxies' policy files) is written out to
~/.local/share/devvm/assets/<hash>, atomically, files 600 and folders
700; devvm gc deletes older copies no VM's proxy was started with
(gc_assets, deleted_assets). Release archives hold the binary with
README.md, CHANGELOG.md and LICENSE, and the formula installs the
binary alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:12:37 -06:00

27 lines
589 B
Go

// Package paths names every folder and file devvm uses: its binary, and
// the folders it keeps state in.
package paths
import (
"fmt"
"os"
"path/filepath"
)
// Self returns the running binary's path, after following links.
func Self() (string, error) {
exe, err := os.Executable()
if err != nil {
return "", fmt.Errorf("finding devvm's binary: %w", err)
}
return resolve(exe)
}
func resolve(exe string) (string, error) {
resolved, err := filepath.EvalSymlinks(exe)
if err != nil {
return "", fmt.Errorf("following links from %s: %w", exe, err)
}
return resolved, nil
}