File utilities

Overview

Utility functions to work with files, UNICODE support. More…

// namespaces

namespace FileUtils;

// global functions

std::string FileUtils::absoluteFilePath(const std::string& filePath);
void FileUtils::createDirectoryRecursive(const std::string& dirPath);
bool FileUtils::directoryExists(const std::string& path);
long long FileUtils::fileSize(const char \* fileName);

template <typename C, typename = enableIfSupportedChar<C>>
long long FileUtils::fileSize(const std::basic_string<C>& f);

template <typename C, typename = enableIfSupportedChar<C>>
bool FileUtils::fileExist(const C \* fileName);

template <typename C, typename = enableIfSupportedChar<C>>
bool FileUtils::fileExist(const std::basic_string<C>& fileName);

template <typename C, typename = enableIfSupportedChar<C>>
std::basic_string<C> FileUtils::makePath(
    const std::basic_string<C>& folder,
    const std::basic_string<C>& file
    );

template <typename C, typename = enableIfSupportedChar<C>>
std::basic_string<C> FileUtils::fileExt(const std::basic_string<C>& filename);

std::string InferenceEngine::getIELibraryPath();

Detailed Documentation

Utility functions to work with files, UNICODE support.

Global Functions

std::string FileUtils::absoluteFilePath(const std::string& filePath)

Interface function to get absolute path of file.

Parameters:

filePath

  • path to file, can be relative to current working directory

InferenceEngine::Exception

if any error occurred

Returns:

Absolute path of file

void FileUtils::createDirectoryRecursive(const std::string& dirPath)

Interface function to create directorty recursively by given path.

Parameters:

dirPath

  • path to file, can be relative to current working directory

InferenceEngine::Exception

if any error occurred

bool FileUtils::directoryExists(const std::string& path)

Interface function to check if directory exists for given path.

Parameters:

path

  • path to directory

Returns:

true if directory exists, false otherwise

long long FileUtils::fileSize(const char \* fileName)

Interface function to get the size of a file. The function supports UNICODE path.

Parameters:

fileName

  • name of the file

Returns:

size of the file

template <typename C, typename = enableIfSupportedChar<C>>
long long FileUtils::fileSize(const std::basic_string<C>& f)

Function to get the size of a file. The function supports UNICODE path.

Parameters:

f

  • string name of the file

Returns:

size of the file

template <typename C, typename = enableIfSupportedChar<C>>
bool FileUtils::fileExist(const C \* fileName)

check if file with a given filename exists. The function supports UNICODE path

Parameters:

fileName

  • given filename

Returns:

true is exists

template <typename C, typename = enableIfSupportedChar<C>>
bool FileUtils::fileExist(const std::basic_string<C>& fileName)

check if file with a given filename exists. The function supports UNICODE path

Parameters:

fileName

  • string with a given filename

Returns:

true is exists

template <typename C, typename = enableIfSupportedChar<C>>
std::basic_string<C> FileUtils::makePath(
    const std::basic_string<C>& folder,
    const std::basic_string<C>& file
    )

CPP Interface function to combint path with filename. The function supports UNICODE path.

Parameters:

folder

  • path to add filename to

file

  • filename to add to path

Returns:

string with combination of the path and the filename divided by file separator

template <typename C, typename = enableIfSupportedChar<C>>
std::basic_string<C> FileUtils::fileExt(const std::basic_string<C>& filename)

CPP Interface function to extract extension from filename.

Parameters:

filename

  • string with the name of the file which extension should be extracted

Returns:

string with extracted file extension

std::string InferenceEngine::getIELibraryPath()

Returns a path to Inference Engine library.

Returns:

A std::string path to Inference Engine library