| 1322 | } |
| 1323 | |
| 1324 | std::string CutOutURLPath(const std::string& url) |
| 1325 | { |
| 1326 | const char* pData = url.c_str(); |
| 1327 | |
| 1328 | // All this is to cut out the part after the URL. (so https://discord.com/test -> https://discord.com) |
| 1329 | int slashesToSkip = 1; |
| 1330 | |
| 1331 | const char* startLookUp = strstr(pData, "://"); |
| 1332 | if (startLookUp) |
| 1333 | slashesToSkip = 3; |
| 1334 | else |
| 1335 | startLookUp = pData; |
| 1336 | |
| 1337 | size_t i = 0; |
| 1338 | for (; startLookUp[i] != '\0'; i++) { |
| 1339 | if (startLookUp[i] == '/') |
| 1340 | slashesToSkip--; |
| 1341 | if (!slashesToSkip) |
| 1342 | break; |
| 1343 | } |
| 1344 | |
| 1345 | std::string actualUrl; |
| 1346 | if (slashesToSkip != 0) { |
| 1347 | actualUrl = std::string(pData); |
| 1348 | } |
| 1349 | else { |
| 1350 | actualUrl = std::string(pData, i + (startLookUp - pData)); |
| 1351 | } |
| 1352 | |
| 1353 | return actualUrl; |
| 1354 | } |
| 1355 | |
| 1356 | LRESULT HandleGestureMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, float mulDeltas) |
| 1357 | { |