srcDir

tcmts.cli.views.srcDir · #ctnyfoqw · term · runs on the server

uses node:path

Where a branch's views are (its definitions as files, for editors, debuggers and stack traces), each branch's its own, as a git worktree's checkout is: the codebase's own branch's (the one tcm switch checks out) in .tcm/src, a session's in its directory (.tcm/sessions/<branch>/src). This process's branch's, or the one it reads (--branch): nothing writes those, they're rendered.

import { sessionDirFor } from "#codebase/tcmts/cli/codebase";
import type { CodebaseCore } from "#codebase/tcmts/cli/codebase";
import path_1 from "node:path";

export function srcDir(cb: CodebaseCore): string {
  const reading = cb.store.reading;
  const own =
    reading === undefined
      ? cb.sessionDir
      : reading === cb.store.getSetting("branch")
        ? undefined
        : sessionDirFor(cb.lay.root, reading);
  return path_1.join(own ?? cb.lay.tcmDir, "src");
}

uses

used by