| 1088 | } |
| 1089 | |
| 1090 | String FileSystem::GetExtension(StringView path) |
| 1091 | { |
| 1092 | StringView fileName = GetFileName(path); |
| 1093 | if (fileName.empty()) return {}; |
| 1094 | |
| 1095 | const StringView foundDot = fileName.findLastOr('.', fileName.end()); |
| 1096 | if (foundDot.begin() == fileName.end()) return {}; |
| 1097 | |
| 1098 | bool initialDots = true; |
| 1099 | for (char c : fileName.prefix(foundDot.begin())) { |
| 1100 | if (c != '.') { |
| 1101 | initialDots = false; |
| 1102 | break; |
| 1103 | } |
| 1104 | } |
| 1105 | if (initialDots) return {}; |
| 1106 | String result = fileName.suffix(foundDot.end()); |
| 1107 | |
| 1108 | // Convert to lower-case |
| 1109 | for (char& c : result) { |
| 1110 | if (c >= 'A' && c <= 'Z') { |
| 1111 | c |= 0x20; |
| 1112 | } |
| 1113 | } |
| 1114 | |
| 1115 | return result; |
| 1116 | } |
| 1117 | |
| 1118 | #if defined(DEATH_TARGET_WINDOWS) |
| 1119 | String FileSystem::FromNativeSeparators(String path) |