Files
42_INT_12_webserv/srcs/config/compareLocationConfigs.cpp

28 lines
570 B
C++

// prolly get rid of this file...
#include "LocationConfig.hpp"
#include <string>
#include <algorithm>
// Ok so maybe it can't be a member functions?
bool compareLocationConfigs(const LocationConfig &a, const LocationConfig &b)
{
int len_a;
int len_b;
size_t tmp = 0;
// consider adding 1 to path that ends in a file not folder.
while ((tmp = a.path.find_first_of("/", tmp)) != std::string::npos)
++len_a;
tmp = 0;
while ((tmp = b.path.find_first_of("/", tmp)) != std::string::npos)
++len_b;
return (len_a < len_b); // right comparison ? not <= ?
}