Treelite
|
Cross-platform wrapper for common filesystem functions. More...
#include <treelite/filesystem.h>
#include <dmlc/logging.h>
#include <fstream>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <libgen.h>
#include <cstring>
Go to the source code of this file.
Functions | |
void | CreateDirectoryIfNotExist (const char *dirpath) |
Create a directory with a given name if one doesn't exist already. More... | |
void | WriteToFile (const std::string &filename, const std::string &content) |
Write a sequence of strings to a text file, with newline character ( ) inserted between strings. This function is suitable for creating multi-line text files. More... | |
void | WriteToFile (const std::string &filename, const std::vector< char > &content) |
Write a sequence of bytes to a text file. More... | |
Cross-platform wrapper for common filesystem functions.
Copyright (c) 2020 by Contributors
Definition in file filesystem.cc.
void CreateDirectoryIfNotExist | ( | const char * | dirpath | ) |
Create a directory with a given name if one doesn't exist already.
dirpath | Path to directory to be created. |
Definition at line 54 of file filesystem.cc.
void WriteToFile | ( | const std::string & | filename, |
const std::string & | content | ||
) |
Write a sequence of strings to a text file, with newline character (
) inserted between strings. This function is suitable for creating multi-line text files.
filename | name of text file |
lines | a sequence of strings to be written. |
Definition at line 88 of file filesystem.cc.
void WriteToFile | ( | const std::string & | filename, |
const std::vector< char > & | content | ||
) |
Write a sequence of bytes to a text file.
filename | name of text file |
lines | a sequence of strings to be written. |
Definition at line 93 of file filesystem.cc.