Versions 13 to 318
new file, 67 lines
1+// Where abso keeps its state (the rename from avcs). Reading takes .abso/ first, then .avcs/, so a folder in
2+// either works. A new folder is made with .abso/ unless an edit mod installed here is from before the rename:
3+// such a mod looks only for .avcs/config.json, and would stop recording a .abso/ folder's edits without a word.
4+// So a new folder gets .avcs/ while any installed mod is older than MOD_KNOWS_ABSO, and .abso/ otherwise.
5+// The user's files are written to ~/.abso/ (an older client that can't find them says so: it isn't silent).
7+
11+
15+
16+/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else the new folder's name (newFolderDir). */
18+ for (const name of STATE_DIRS) if (existsSync(join(root, name, "config.json"))) return join(root, name);
22+
23+/** The first mod version whose hooks look for .abso/config.json as well as .avcs/config.json. */
25+
28+
37+
38+/** What a new folder is made with: .abso, unless an installed mod is older than the rename (see the top). */
39+export function newFolderDir(env: Readonly<Record<string, string | undefined>> = process.env): string {
45+ version = (JSON.parse(readFileSync(join(skills, name, ".avcs-install.json"), "utf8")) as { version?: unknown })
50+ if (typeof version !== "string" || !versionAtLeast(version, MOD_KNOWS_ABSO)) return OLD_STATE_DIR;
54+
55+/** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */
63+
64+/** Where to write a file under the user's home: always the new place. The old file is left as it is, for older clients and mods. */
- MCP
- compare on this site's /mcp
- CLI
- abso diff 13 318 client/src/state-dir.ts --json
- JSON
- /christopher/abso-core/compare/13..318?file=client%2Fsrc%2Fstate-dir.ts&format=json