#include "utils.ih"

string Utils::dirname(string const &path)
{
    string ret{path.find("./") == 0 ? path.substr(2) : path};

    size_t pos = ret.rfind('/');

    if (pos != string::npos)
        ret.resize(pos);
    else
        ret = '.';

    return ret;
}
