MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / resolveWritableLogDir

Function resolveWritableLogDir

src/utils/xcodebuild-log-capture.ts:15–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13}
14
15function resolveWritableLogDir(): ResolvedLogDir {
16 const logDir =
17 logDirOverrideForTests ?? getWorkspaceFilesystemLayout(getRuntimeInstance().workspaceKey).logs;
18
19 try {
20 fs.mkdirSync(logDir, { recursive: true });
21 fs.accessSync(logDir, fs.constants.W_OK);
22 } catch (error) {
23 const message = error instanceof Error ? error.message : String(error);
24 throw new Error(`Unable to create writable log directory at ${logDir}: ${message}`);
25 }
26
27 return {
28 path: logDir,
29 isOverride: logDirOverrideForTests !== null,
30 };
31}
32
33function generateLogFileName(toolName: string): string {
34 return `${toolName}_${formatLogTimestamp()}_pid${process.pid}_${shortRandomSuffix()}.log`;

Callers 2

createLogCaptureFunction · 0.85
flushFunction · 0.85

Calls 2

getRuntimeInstanceFunction · 0.90

Tested by

no test coverage detected