flowDBPath returns the absolute path to flow.db under the flow root. Returns a clear error if the data directory hasn't been initialized.
()
| 25 | // flowDBPath returns the absolute path to flow.db under the flow root. |
| 26 | // Returns a clear error if the data directory hasn't been initialized. |
| 27 | func flowDBPath() (string, error) { |
| 28 | root, err := flowRoot() |
| 29 | if err != nil { |
| 30 | return "", err |
| 31 | } |
| 32 | dbPath := filepath.Join(root, "flow.db") |
| 33 | if _, err := os.Stat(dbPath); os.IsNotExist(err) { |
| 34 | return "", fmt.Errorf("flow is not initialized — run `flow init` to set up %s", root) |
| 35 | } |
| 36 | return dbPath, nil |
| 37 | } |
| 38 | |
| 39 | // cmdInit creates ~/.flow/ (or $FLOW_ROOT), initializes flow.db, installs |
| 40 | // the skill. Idempotent — re-running is safe. |