| 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 | { |