MCPcopy Create free account
hub / github.com/VKCOM/nocc / MapClientFileNameToServerAbs

Method MapClientFileNameToServerAbs

internal/server/client.go:78–86  ·  view source on GitHub ↗

MapClientFileNameToServerAbs converts a client file name to an absolute path on server. For example, /proj/1.cpp maps to /tmp/nocc/cpp/clients/{clientID}/proj/1.cpp. Note, that system files like /usr/local/include are required to be equal on both sides. (if not, a server session will fail to start,

(clientFileName string)

Source from the content-addressed store, hash-verified

76// Note, that system files like /usr/local/include are required to be equal on both sides.
77// (if not, a server session will fail to start, and a client will fall back to local compilation)
78func (client *Client) MapClientFileNameToServerAbs(clientFileName string) string {
79 if clientFileName[0] == '/' {
80 if IsSystemHeaderPath(clientFileName) {
81 return clientFileName
82 }
83 return client.workingDir + clientFileName
84 }
85 return path.Join(client.workingDir, clientFileName)
86}
87
88// MapServerAbsToClientFileName converts an absolute path on server relatively to the client working dir.
89// For example, /tmp/nocc/cpp/clients/{clientID}/proj/1.cpp maps to /proj/1.cpp.

Callers 2

makeNewFileMethod · 0.95

Calls 1

IsSystemHeaderPathFunction · 0.85

Tested by

no test coverage detected