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 <string.h>
10#include <stdlib.h>
11
12
13
14namespace KolibriLib
15{
18 namespace filesystem
19 {
23 int CreateFile(const char *name)
24 {
25 return _ksys_file_create(name);
26 }
31 int CreateFile(const char *name, char *path)
32 {
33 strcat(path, name);
34 int ret = _ksys_file_create(path);
35 return ret;
36 }
40 int CreateFile(std::string name)
41 {
42 return _ksys_file_create(name.c_str());
43 }
48 int CreateFile(std::string name, std::string path)
49 {
50 std::string fullPath = path + name;
51 return _ksys_file_create(fullPath.c_str());
52 }
53
54
58 int Delete(const char *name)
59 {
60 return _ksys_file_delete(name);
61 }
66 int Delete(const char *name, char *path)
67 {
68 strcat(path, name);
69 return _ksys_file_delete(path);
70 }
74 int Delete(std::string name)
75 {
76 return _ksys_file_delete(name.c_str());
77 }
82 int Delete(std::string name, std::string path)
83 {
84 std::string fullPath = path + name;
85 return _ksys_file_delete(fullPath.c_str());
86 }
87
88
89
93 int mkdir(const char *path)
94 {
95 return _ksys_mkdir(path);
96 }
100 int mkdir(std::string path)
101 {
102 return _ksys_mkdir(path.c_str());
103 }
104
108 bool Exist(std::string Path)
109 {
110 ksys_bdfe_t *buff;
111 if(_ksys_file_info(Path.c_str(), buff) > 0)
112 {
113 return true;
114 }
115 else
116 {
117 return false;
118 }
119 }
120
121 int Rename(std::string OldName, std::string NewName)
122 {
123 return _ksys_file_rename(OldName.c_str(), NewName.c_str());
124 }
125
126
127 }
128} // namespace KolibriLib
129
130
131
132#endif // __FILESYSTEM_H__
int Delete(const char *name)
удалить файл или папку
Definition filesystem.hpp:58
bool Exist(std::string Path)
проверяет существует ли файл или папки
Definition filesystem.hpp:108
int mkdir(const char *path)
Создать папку
Definition filesystem.hpp:93
int CreateFile(const char *name)
Создать файл
Definition filesystem.hpp:23
Основное пространство имён
Definition base.hpp:17