<commit_before>#include <Core/Resources/Resources.hpp>

#include <Core/Utils/Log.hpp>
#include <algorithm>
#include <cpplocate/cpplocate.h>

#ifndef CXX_FILESYSTEM_HAVE_FS
#    error std::filesystem is required to compile this file
#endif
#if CXX_FILESYSTEM_IS_EXPERIMENTAL
#    include <experimental/filesystem>

// We need the alias from std::experimental::filesystem to std::filesystem
namespace std {
namespace filesystem = experimental::filesystem;
}

#else
#    include <filesystem>
#endif

namespace Ra {
namespace Core {
namespace Resources {

using namespace Ra::Core::Utils;
std::filesystem::path searchPath( std::string pattern, std::string offset, void* libSymbol ) {
    std::string baseDir = cpplocate::locatePath( pattern, offset, libSymbol );
    std::filesystem::path p( baseDir );
    return std::filesystem::canonical( p );
}

std::string getRadiumResourcesPath() {
    auto basePath =
        searchPath( "Resources/Shaders", "", reinterpret_cast<void*>( getRadiumResourcesPath ) );
    auto resourcesPath = basePath / "Resources" / "";
    return resourcesPath.string();
}

std::string getRadiumPluginsPath() {
    auto basePath =
        searchPath( "Plugins/lib", "", reinterpret_cast<void*>( getRadiumPluginsPath ) );
    auto pluginsPath = basePath / "Plugins" / "lib" / "";
    return pluginsPath.string();
}

std::string getBasePath() {
    return cpplocate::getModulePath();
}

std::string getBaseResourcesPath() {
    auto baseDir = cpplocate::locatePath( "Resources", "", nullptr );
    return baseDir + "Resources/";
}

std::string getResourcesPath( void* symbol, const std::string& offset ) {
    return ( searchPath( "/", "", symbol ) / offset ).string();
}

std::string getResourcesPath( void* symbol, std::string pattern, const std::string& offset ) {
    return ( searchPath( pattern, offset, symbol ) / pattern ).string();
}

} // namespace Resources
} // namespace Core
} // namespace Ra<commit_msg>[core] Resources refactor/clean<commit_after>#include <Core/Resources/Resources.hpp>

#include <Core/Utils/Log.hpp>
#include <algorithm>
#include <cpplocate/cpplocate.h>

#ifndef CXX_FILESYSTEM_HAVE_FS
#    error std::filesystem is required to compile this file
#endif
#if CXX_FILESYSTEM_IS_EXPERIMENTAL
#    include <experimental/filesystem>

// We need the alias from std::experimental::filesystem to std::filesystem
namespace std {
namespace filesystem = experimental::filesystem;
}

#else
#    include <filesystem>
#endif

namespace Ra {
namespace Core {
namespace Resources {

std::filesystem::path
searchPath( const std::string& pattern, const std::string& offset, void* libSymbol ) {
    std::string basePath = cpplocate::locatePath( pattern, offset, libSymbol );
    return std::filesystem::canonical( std::filesystem::path( basePath ) );
}

std::string getRadiumResourcesPath() {
    auto basePath =
        searchPath( "Resources/Shaders", "", reinterpret_cast<void*>( getRadiumResourcesPath ) );
    return ( basePath / "Resources" / "" ).string();
}

std::string getRadiumPluginsPath() {
    auto basePath =
        searchPath( "Plugins/lib", "", reinterpret_cast<void*>( getRadiumPluginsPath ) );
    return ( basePath / "Plugins" / "lib" / "" ).string();
}

std::string getBasePath() {
    return cpplocate::getModulePath();
}

std::string getBaseResourcesPath() {
    auto baseDir = searchPath( "Resources", "", nullptr );
    return ( baseDir / "Resources" / "" ).string();
}

std::string getResourcesPath( void* symbol, const std::string& offset ) {
    return ( searchPath( "/", "", symbol ) / offset ).string();
}

std::string getResourcesPath( void* symbol, std::string pattern, const std::string& offset ) {
    return ( searchPath( pattern, offset, symbol ) / pattern ).string();
}

} // namespace Resources
} // namespace Core
} // namespace Ra
{'fraction_non_alphanumeric': 0.14037854889589904, 'fraction_numerical': 0.0, 'mean_word_length': 4.7218045112781954, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '224726', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1127, 'n_words': 287}