MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getTerminalDataDirs

Function getTerminalDataDirs

src/cm/lsp/serverLauncher.ts:91–120  ·  view source on GitHub ↗

* Get candidate Terminal data directories from system.getFilesDir(). * Newer Terminal builds keep shared runtime state in public. Older builds used * alpine/home, and some installs keep it as a symlink for shell compatibility.

()

Source from the content-addressed store, hash-verified

89 * alpine/home, and some installs keep it as a symlink for shell compatibility.
90 */
91async function getTerminalDataDirs(): Promise<string[]> {
92 if (cachedFilesDir) {
93 return [`${cachedFilesDir}/public`, `${cachedFilesDir}/alpine/home`];
94 }
95
96 const system = (
97 globalThis as unknown as {
98 system?: {
99 getFilesDir: (
100 success: (filesDir: string) => void,
101 error: (error: string) => void,
102 ) => void;
103 };
104 }
105 ).system;
106
107 if (!system?.getFilesDir) {
108 throw new Error("System plugin is not available");
109 }
110
111 return new Promise((resolve, reject) => {
112 system.getFilesDir(
113 (filesDir: string) => {
114 cachedFilesDir = filesDir;
115 resolve([`${filesDir}/public`, `${filesDir}/alpine/home`]);
116 },
117 (error: string) => reject(new Error(error)),
118 );
119 });
120}
121
122/**
123 * Get the port file path for a given server and session.

Callers 1

getPortFilePathsFunction · 0.85

Calls 2

resolveFunction · 0.85
getFilesDirMethod · 0.80

Tested by

no test coverage detected