MCPcopy Create free account
hub / github.com/carbonengine/trinity / JoinPath

Function JoinPath

shadercompiler/CachingIncludeHandler.cpp:36–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36std::optional<std::string> JoinPath( const char* path1, const char* path2 )
37{
38#if _WIN32
39 char p1[MAX_PATH];
40 strcpy_s( p1, path1 );
41 if( !PathAppend( p1, path2 ) )
42 {
43 return std::nullopt;
44 }
45 for( auto p = p1; *p; ++p )
46 {
47 if( *p == '/' )
48 {
49 *p = '\\';
50 }
51 }
52 char fullPath[MAX_PATH];
53 if( !PathCanonicalize( fullPath, p1 ) )
54 {
55 return std::nullopt;
56 }
57 return fullPath;
58#else
59 // TODO MACOS
60 return std::string( path1 ) + "/" + path2;
61#endif
62}
63
64}
65

Callers 2

OpenMethod · 0.85
AddPrefixMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected