MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / CombinePath

Method CombinePath

Sources/Shared/IO/FileSystem.cpp:949–978  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947#endif
948
949 String FileSystem::CombinePath(StringView first, StringView second)
950 {
951 std::size_t firstSize = first.size();
952 std::size_t secondSize = second.size();
953
954 if (secondSize == 0) {
955 return first;
956 }
957 if (firstSize == 0 || GetPathRootLength(second) > 0) {
958 return second;
959 }
960
961# if defined(DEATH_TARGET_ANDROID)
962 if (first == AndroidAssetStream::Prefix) {
963 return first + second;
964 }
965# endif
966
967 if (first[firstSize - 1] == '/' || first[firstSize - 1] == '\\') {
968 // Path has trailing separator
969 return first + second;
970 } else {
971 // Both paths have no clashing separators
972#if defined(DEATH_TARGET_WINDOWS)
973 return "\\"_s.join({ first, second });
974#else
975 return "/"_s.join({ first, second });
976#endif
977 }
978 }
979
980 String FileSystem::CombinePath(ArrayView<const StringView> paths)
981 {

Callers

nothing calls this directly

Calls 6

GetPathRootLengthFunction · 0.85
arrayViewFunction · 0.50
sizeMethod · 0.45
joinMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected