ContRap-Core
|
This file contains platform independent file operations. More...
#include <vector>
#include <string>
#include "core/coreexports.h"
#include "core/systemtools.h"
#include "core/stringtools.h"
Namespaces | |
namespace | crp |
The namespace crp is the namespace for all ContRap core components and libraries. | |
Functions | |
CONTRAP_CORE_API std::vector < std::string > | crp::get_files_in_folder (const std::string &path) |
Returns all files in a folder. | |
CONTRAP_CORE_API std::vector < std::string > | crp::get_folder_contents (const std::string &path) |
Returns all files in a folder including directories. | |
CONTRAP_CORE_API bool | crp::directory_exists (const std::string &path) |
Checks if a directory exists. | |
CONTRAP_CORE_API bool | crp::is_symbolic_link (const std::string &path) |
Checks if a file is a symbolic link. | |
CONTRAP_CORE_API bool | crp::file_exists (const std::string &file_name) |
Checks whether a file exists. | |
CONTRAP_CORE_API int | crp::get_file_size (const std::string &file_name) |
Returns the size of a file. | |
CONTRAP_CORE_API void | crp::create_directory (const std::string &path) |
Creates a directory. | |
CONTRAP_CORE_API std::string | crp::to_native_path (const std::string &path) |
Converts a path to the native system path. | |
CONTRAP_CORE_API std::string | crp::to_simple_path (const std::string &path) |
Simplifies a path not to contain trailing or double path delimiters. | |
CONTRAP_CORE_API bool | crp::is_relative_path (const std::string &path) |
Checks if a file path is a relative path or not. | |
CONTRAP_CORE_API std::string | crp::get_name_component (const std::string &path) |
Returns the name component of a file path. | |
CONTRAP_CORE_API std::string | crp::get_path_component (const std::string &file_name) |
Returns the path of a file name by splitting up the last component. | |
CONTRAP_CORE_API std::string | crp::relative_path (const std::string &reference, const std::string relative) |
Creates a path relative to a given path. | |
CONTRAP_CORE_API std::string | crp::make_temporary_file () |
Makes a temporary file name. | |
CONTRAP_CORE_API bool | crp::read_file (const std::string &file_name, std::string &contents) |
Reads a file to a string. | |
CONTRAP_CORE_API bool | crp::write_file (const std::string &file_name, const std::string &contents) |
Writes a string to a file. | |
CONTRAP_CORE_API time_t | crp::time_of_last_change (const std::string &file_name) |
Returns the date of last file change. | |
CONTRAP_CORE_API std::vector < std::string > | crp::break_paths (const std::string &paths) |
Breaks a ":"-separeted list of paths into a vector. | |
CONTRAP_CORE_API std::string | crp::is_library_path (const std::string &path) |
Returns a non-empty string if the file path is a path to a ContRap library. |
This file contains platform independent file operations.
This file is a part of ContRap.
Copyright (c) 2009-2010 by Aless Lasaruk. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of ContRap nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.