<commit_before>/** \file
 *  Utility functions for interacting with the filesystem.
 *  
 *  Copyright (c) 2015 by <NAME>. All rights reserved.
 *
 *  This program is free software: you can redistribute it and/or modify it under the terms of the Apache License
 *  as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later
 *  version.
 *
 *  \author <NAME> (<EMAIL>)
**/
#include "filesystem_util.hpp"

#include <jsonv/detail/scope_exit.hpp>

#ifdef _MSC_VER

#include <Windows.h>

namespace jsonv_test
{

std::string filename(std::string path)
{
    return path;
}

void recursive_directory_for_each(const std::string&                             root_path_name,
                                  const std::string&                             extension_filter,
                                  const std::function<void (const std::string&)> action
                                 )
{
    WIN32_FIND_DATA found_file;
    HANDLE search_handle = NULL;
<commit_msg>MSVC: Support \ in filenames.<commit_after>/** \file
 *  Utility functions for interacting with the filesystem.
 *  
 *  Copyright (c) 2015 by <NAME>. All rights reserved.
 *
 *  This program is free software: you can redistribute it and/or modify it under the terms of the Apache License
 *  as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later
 *  version.
 *
 *  \author <NAME> (<EMAIL>)
**/
#include "filesystem_util.hpp"

#include <jsonv/detail/scope_exit.hpp>

#ifdef _MSC_VER

#include <Windows.h>

namespace jsonv_test
{

std::string filename(std::string path)
{
    auto pos = path.find_last_of('\\');
    return path.substr(pos + 1);
}

void recursive_directory_for_each(const std::string&                             root_path_name,
                                  const std::string&                             extension_filter,
                                  const std::function<void (const std::string&)> action
                                 )
{
    WIN32_FIND_DATA found_file;
    HANDLE search_handle = NULL;

{'fraction_non_alphanumeric': 0.0909952606635071, 'fraction_numerical': 0.0071090047393364926, 'mean_word_length': 2.2627511591962906, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4721407', 'n_tokens_mistral': 609, 'n_tokens_neox': 579, 'n_words': 189}