<commit_before>//
// Copyright (C) 2007 <NAME>
// All rights reserved.
// Licensed to the public under the terms of the GNU LGPL (>= 2),
// see the file COPYING for details.
//
//

#ifndef Support_path_hh_
#define Support_path_hh_

#include <boost/filesystem/operations.hpp>

namespace Synopsis
{

//. Get normalized absolute path of a filename.
inline boost::filesystem::path get_path(std::string const &filename)
{
  using namespace boost::filesystem;
  return system_complete(path(filename, native)).normalize();
}

//. Return true if base_path is set and path p contains base_path.
inline bool matches_path(std::string const &p, std::string const &base_path)
{
  return !base_path.empty() && p.substr(0,base_path.size()) == base_path;
}
  
//. Return the string representation of file in native path
//. nomenclature.
inline std::string make_full_path(std::string const &p)
{
  return get_path(p).native_file_string();
}
  
//. Given a path, strip the base_path.
inline std::string make_short_path(std::string const &p, std::string const &base_path)
{
  std::string short_fname = make_full_path(p);
  if (matches_path(short_fname, base_path))
    short_fname.erase(0, base_path.size());
  return short_fname;
}

}

#endif
<commit_msg>Fix boost.filesystem v3 compatibility.<commit_after>//
// Copyright (C) 2007 <NAME>
// All rights reserved.
// Licensed to the public under the terms of the GNU LGPL (>= 2),
// see the file COPYING for details.
//
//

#ifndef Support_path_hh_
#define Support_path_hh_

#include <boost/filesystem/operations.hpp>

namespace Synopsis
{

//. Get normalized absolute path of a filename.
inline boost::filesystem::path get_path(std::string const &filename)
{
  using namespace boost::filesystem;
  return system_complete(path(filename)).normalize();
}

//. Return true if base_path is set and path p contains base_path.
inline bool matches_path(std::string const &p, std::string const &base_path)
{
  return !base_path.empty() && p.substr(0,base_path.size()) == base_path;
}
  
//. Return the string representation of file in native path
//. nomenclature.
inline std::string make_full_path(std::string const &p)
{
  return get_path(p).string();
}
  
//. Given a path, strip the base_path.
inline std::string make_short_path(std::string const &p, std::string const &base_path)
{
  std::string short_fname = make_full_path(p);
  if (matches_path(short_fname, base_path))
    short_fname.erase(0, base_path.size());
  return short_fname;
}

}

#endif

{'fraction_non_alphanumeric': 0.12696493349455865, 'fraction_numerical': 0.006045949214026602, 'mean_word_length': 4.6281179138322, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4771167', 'n_tokens_mistral': 822, 'n_tokens_neox': 809, 'n_words': 236}