Shiokaze Framework
A research-oriented fluid solver for computer graphics
filesystem.h
Go to the documentation of this file.
1 /*
2 ** filesystem.h
3 **
4 ** This is part of Shiokaze, a research-oriented fluid solver for computer graphics.
5 ** Created by Ryoichi Ando <rand@nii.ac.jp> on Feb 6, 2017.
6 **
7 ** Permission is hereby granted, free of charge, to any person obtaining a copy of
8 ** this software and associated documentation files (the "Software"), to deal in
9 ** the Software without restriction, including without limitation the rights to use,
10 ** copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11 ** Software, and to permit persons to whom the Software is furnished to do so,
12 ** subject to the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included in all copies
15 ** or substantial portions of the Software.
16 **
17 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 ** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 ** HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 ** CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 //
25 #ifndef SHKZ_FILESYSTEM_H
26 #define SHKZ_FILESYSTEM_H
27 //
28 #include <shiokaze/core/common.h>
29 #include <string>
30 //
32 //
34 class filesystem {
37 public:
46  static bool is_exist( std::string path );
55  static bool has_parent( std::string path );
64  static std::string parent_path( std::string path );
73  static bool has_root( std::string path );
80  static bool create_directory( std::string path );
87  static bool create_directories( std::string path );
96  static void rename( std::string old_path, std::string new_path );
103  static void remove_file( std::string path );
110  static void remove_dir_contents( std::string path );
119  static std::string find_resource_path( std::string directory, std::string name );
126  static std::string resolve_libname( std::string name );
127 };
128 //
130 //
131 #endif
filesystem::resolve_libname
static std::string resolve_libname(std::string name)
Get a file path in the dynamic library directory.
filesystem::find_resource_path
static std::string find_resource_path(std::string directory, std::string name)
Get a file path in the resource directory.
filesystem::create_directory
static bool create_directory(std::string path)
Create directory to a path.
SHKZ_BEGIN_NAMESPACE
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
filesystem::parent_path
static std::string parent_path(std::string path)
Get the path to the parent directory.
filesystem::is_exist
static bool is_exist(std::string path)
Check if the file to a path exists.
filesystem::remove_file
static void remove_file(std::string path)
Delete the file to a path.
filesystem::remove_dir_contents
static void remove_dir_contents(std::string path)
Delete all the files in a directory.
filesystem
Class that perform file system related tasks.
Definition: filesystem.h:36
filesystem::create_directories
static bool create_directories(std::string path)
Recursively create directory to a path.
filesystem::has_root
static bool has_root(std::string path)
Check if a path contains a root path.
filesystem::has_parent
static bool has_parent(std::string path)
Check if a path contains a parent directory.
common.h
filesystem::rename
static void rename(std::string old_path, std::string new_path)
Rename the path (equivalently moving a file/directory)
SHKZ_END_NAMESPACE
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44