MCPcopy Create free account
hub / github.com/ddnet/ddnet / ViewFile

Method ViewFile

src/engine/client/client.cpp:5248–5272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5246}
5247
5248bool CClient::ViewFile(const char *pFilename)
5249{
5250#if defined(CONF_PLATFORM_MACOS)
5251 return ViewLinkImpl(pFilename);
5252#else
5253 // Create a file link so the path can contain forward and
5254 // backward slashes. But the file link must be absolute.
5255 char aWorkingDir[IO_MAX_PATH_LENGTH];
5256 if(fs_is_relative_path(pFilename))
5257 {
5258 if(!fs_getcwd(aWorkingDir, sizeof(aWorkingDir)))
5259 {
5260 log_error("client", "Failed to open file '%s' (failed to get working directory)", pFilename);
5261 return false;
5262 }
5263 str_append(aWorkingDir, "/");
5264 }
5265 else
5266 aWorkingDir[0] = '\0';
5267
5268 char aFileLink[IO_MAX_PATH_LENGTH];
5269 str_format(aFileLink, sizeof(aFileLink), "file://%s%s", aWorkingDir, pFilename);
5270 return ViewLinkImpl(aFileLink);
5271#endif
5272}
5273
5274#if defined(CONF_FAMILY_WINDOWS)
5275void CClient::ShellRegister()

Callers 9

RenderSettingsCustomMethod · 0.80
RenderPopupFullscreenMethod · 0.80
RenderSettingsGeneralMethod · 0.80
RenderSettingsTeeMethod · 0.80
RenderSettingsTee7Method · 0.80
RenderGhostMethod · 0.80
OnRenderMethod · 0.80
mainFunction · 0.80

Calls 5

ViewLinkImplFunction · 0.85
fs_is_relative_pathFunction · 0.85
fs_getcwdFunction · 0.85
str_formatFunction · 0.85
str_appendFunction · 0.50

Tested by

no test coverage detected