MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getPublicFilePath

Function getPublicFilePath

server/src/utils/html-config.ts:130–143  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

128 * Handles both tsx (source) and node (dist) execution contexts.
129 */
130export function getPublicFilePath(filename: string): string {
131 // Check if we're running from source (tsx) or dist (node)
132 // In tsx: __dirname is server/src/utils
133 // In dist: __dirname is dist/utils
134 const isRunningFromSource = __dirname.includes('server/src');
135
136 if (isRunningFromSource) {
137 // tsx: server/src/utils -> server/public
138 return path.join(__dirname, "../../public", filename);
139 } else {
140 // dist: dist/utils -> server/public
141 return path.join(__dirname, "../../server/public", filename);
142 }
143}
144
145/**
146 * Resolve the admin flag for a user using the same rules as the requireAdmin

Callers 2

serveHtmlWithConfigFunction · 0.85
serveHtmlWithMetaTagsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected