KolibriLib
Loading...
Searching...
No Matches
filesystem.hpp
1#pragma once
2#ifndef __FILESYSTEM_H__
3#define __FILESYSTEM_H__
4
5
6
7#include <string>
8#include <sys/ksys.h>
9#include <sys/dir.h>
10#include <string.h>
11#include <stdlib.h>
12
13
14
15namespace KolibriLib
16{
19 namespace filesystem
20 {
24 int CreateFile(const char *name)
25 {
26 return _ksys_file_create(name);
27 }
32 int CreateFile(const char *name, char *path)
33 {
34 strcat(path, name);
35 int ret = _ksys_file_create(path);
36 return ret;
37 }
41 int CreateFile(const std::string& name)
42 {
43 return _ksys_file_create(name.c_str());
44 }
49 int CreateFile(const std::string& name, const std::string& path)
50 {
51 std::string fullPath = path + name;
52 return _ksys_file_create(fullPath.c_str());
53 }
54
55
59 int Delete(const char *name)
60 {
61 return _ksys_file_delete(name);
62 }
67 int Delete(const char *name, char *path)
68 {
69 strcat(path, name);
70 return _ksys_file_delete(path);
71 }
75 int Delete(const std::string& name)
76 {
77 return _ksys_file_delete(name.c_str());
78 }
83 int Delete(const std::string& name, const std::string& path)
84 {
85 std::string fullPath = path + name;
86 return _ksys_file_delete(fullPath.c_str());
87 }
88
89
90
94 inline int mkdir(const char *path)
95 {
96 return _ksys_mkdir(path);
97 }
101 inline int mkdir(const std::string& path)
102 {
103 return _ksys_mkdir(path.c_str());
104 }
105
109 bool Exist(const std::string& Path)
110 {
111 ksys_bdfe_t *buff;
112 if(_ksys_file_info(Path.c_str(), buff) > 0)
113 {
114 return true;
115 }
116 else
117 {
118 return false;
119 }
120 }
121
125 inline int Rename(const std::string& OldName, const std::string& NewName)
126 {
127 return _ksys_file_rename(OldName.c_str(), NewName.c_str());
128 }
129
130 namespace Dir
131 {
132
133 }
134
135 }
136} // namespace KolibriLib
137
138
139
140#endif // __FILESYSTEM_H__
int Delete(const char *name)
удалить файл или папку
Definition filesystem.hpp:59
int Rename(const std::string &OldName, const std::string &NewName)
Переименовать файл/папку
Definition filesystem.hpp:125
bool Exist(const std::string &Path)
проверяет существует ли файл или папки
Definition filesystem.hpp:109
int mkdir(const char *path)
Создать папку
Definition filesystem.hpp:94
int CreateFile(const char *name)
Создать файл
Definition filesystem.hpp:24
Основное пространство имён
Definition base.hpp:17