<commit_before>/*******************************************************************************
    Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
    The use of this software is governed by the LICENSE file.
*******************************************************************************/

#pragma once

#include <taichi/common/util.h>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>

#if !defined(TC_PLATFORM_OSX)
#include <experimental/filesystem>
#endif

TC_NAMESPACE_BEGIN

inline void create_directories(const std::string &dir) {
#if !defined(TC_PLATFORM_OSX)
  std::experimental::filesystem::create_directories(dir);
#else
  std::system(fmt::format("mkdir -p {}", dir).c_str());
#endif
}

template <typename T>
void write_to_disk(const T &dat, std::string fn) {<commit_msg>Remove "experimental" in "<experimental/filesystem>" since it is no longer experimental in C++17. (#473)<commit_after>/*******************************************************************************
    Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
    The use of this software is governed by the LICENSE file.
*******************************************************************************/

#pragma once

#include <taichi/common/util.h>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>

#if !defined(TC_PLATFORM_OSX)
#include <filesystem>
#endif

TC_NAMESPACE_BEGIN

inline void create_directories(const std::string &dir) {
#if !defined(TC_PLATFORM_OSX)
  std::filesystem::create_directories(dir);
#else
  std::system(fmt::format("mkdir -p {}", dir).c_str());
#endif
}

template <typename T>
void write_to_disk(const T &dat, std::string fn) {
{'fraction_non_alphanumeric': 0.2962529274004684, 'fraction_numerical': 0.007611241217798595, 'mean_word_length': 7.296116504854369, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '4389933', 'n_tokens_mistral': 515, 'n_tokens_neox': 481, 'n_words': 134}