Treelite
Functions
filesystem.h File Reference

Cross-platform wrapper for common filesystem functions. More...

#include <string>
#include <vector>
Include dependency graph for filesystem.h:
This graph shows which files directly or indirectly include this file:

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...
 

Detailed Description

Cross-platform wrapper for common filesystem functions.

Copyright (c) 2020 by Contributors

Author
Hyunsu Cho

Definition in file filesystem.h.

Function Documentation

◆ CreateDirectoryIfNotExist()

void CreateDirectoryIfNotExist ( const char *  dirpath)

Create a directory with a given name if one doesn't exist already.

Parameters
dirpathPath to directory to be created.

Definition at line 54 of file filesystem.cc.

◆ WriteToFile() [1/2]

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.

Parameters
filenamename of text file
linesa sequence of strings to be written.

Definition at line 88 of file filesystem.cc.

◆ WriteToFile() [2/2]

void WriteToFile ( const std::string &  filename,
const std::vector< char > &  content 
)

Write a sequence of bytes to a text file.

Parameters
filenamename of text file
linesa sequence of strings to be written.

Definition at line 93 of file filesystem.cc.