MCPcopy Create free account
hub / github.com/Kitware/VTK / CreateFullPath

Function CreateFullPath

Common/Core/vtkObjectFactory.cxx:127–145  ·  view source on GitHub ↗

A file scope helper function to concat path and file into a full path

Source from the content-addressed store, hash-verified

125// A file scope helper function to concat path and file into
126// a full path
127static char* CreateFullPath(const std::string& path, const char* file)
128{
129 size_t lenpath = path.size();
130 char* ret = new char[lenpath + strlen(file) + 2];
131#ifdef _WIN32
132 const char sep = '\\';
133#else
134 constexpr char sep = '/';
135#endif
136 // make sure the end of path is a separator
137 strcpy(ret, path.c_str());
138 if (ret[lenpath - 1] != sep)
139 {
140 ret[lenpath] = sep;
141 ret[lenpath + 1] = 0;
142 }
143 strcat(ret, file);
144 return ret;
145}
146
147// A file scope typedef to make the cast code to the load
148// function cleaner to read.

Callers 1

LoadLibrariesInPathMethod · 0.85

Calls 2

sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected