acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
directory_system.h
1// Create on 2021-03-20 23:59 <3ThomasBS_
2#pragma once
3
4
5#if defined(WINDOWS)
6#define PATH_SEPARATOR "\\"
7#else
8#define PATH_SEPARATOR "/"
9#endif
10
11
12#include "acme/prototype/media_library/item.h"
13#include "enumerator.h"
14#include "acme/platform/department.h"
15#include "acme/prototype/collection/map.h"
16#include "acme/prototype/collection/string_map.h"
17#include "acme/parallelization/mutex.h"
18
19
20
21class CLASS_DECL_ACME directory_system :
22 virtual public ::platform::department,
23 virtual public ::file::enumerator
24{
25public:
26
27
28
29
30
31 ::file::path m_pathLocalAppMatterFolder;
32 ::file::path m_pathLocalAppMatterCacheFolder;
33
34 //::pointer<::file::watcher> m_pfilewatcher;
35
36 ::file::path m_pathAppData;
37 ::file::path m_pathDefaultAppData;
38
39 string m_strApiCc;
40
41 ::file::path m_pathCa2Config;
42 //::file::path m_pathModule;
43 ::file::path m_pathHome;
44 ::file::path m_pathInstall;
45
46 bool m_bMatterFromHttpCache;
47 bool m_bMatterFromResource;
48
49
50 ::file::path m_pathUpload;
51
52
53
54
55 //class music_item :
56 // virtual public library_item
57 //{
58 //public:
59
60
61 // ::string m_strTitle;
62 // ::string m_strArtist;
63
64
65 //};
66
67
68 //class image_item :
69 // virtual public library_item
70 //{
71 //public:
72
73
74 // ::string m_strTitle;
75
76
77 //};
78
79
80 //class video_item :
81 // virtual public library_item
82 //{
83 //public:
84
85
86 // ::string m_strTitle;
87 // ::string m_strArtist;
88
89
90 //};
91
92
93
94 ::IDENTIFIER_SUFFIX_OPERATING_SYSTEM(acme_)::directory_system * m_pplatformdir;
95 ::file_system * m_pfilesystem;
96 ::path_system * m_ppathsystem;
97
98 ::file::path m_pathInstallFolder;
99 //::file::path m_pathModuleFolder;
100
101
102 ::media_library::item_map m_medialibraryitemmap;
103
104 ::pointer < ::mutex > m_pmutexMediaLibrary;
105 ::file::path m_pathFolder;
106
107
108 directory_system();
109 ~directory_system() override;
110
111
112 void initialize(::particle * pparticle) override;
113
114
115 //virtual ::file::path module_folder();
116
117
118 virtual ::file::path app(const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
119 virtual ::file::path app_app_admin(const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
120 virtual ::file::path app_app_nest(const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
121 virtual ::file::path app_app(const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
122 virtual ::file::path vcredist(const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
123 virtual ::file::path install_log(const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
124
125
126 virtual ::file::path install();
127 virtual ::file::path default_install();
128 virtual ::file::path beforeca2();
129 virtual ::file::path module();
130 virtual ::file::path relative(::file::path path);
131 virtual ::string appid();
132 virtual ::file::path appdata(); // appdata
133 virtual ::file::path archive();
134 virtual ::file::path tool();
135 //virtual ::file::path public_system();
136 //virtual ::file::path system();
137 virtual ::file::path userconfig();
138 virtual ::file::path config();
139 virtual ::file::path local();
140 virtual ::file::path sensitive();
141 virtual ::file::path localconfig(); // #vcs C:\\Users\\user\\AppData\\Roaming\\ca2\\localconfig
142 virtual ::file::path ca2roaming(); // writable root (non-bin, non-exe)
143 virtual ::file::path ca2appdata(); // writable root (non-bin, non-exe)
144 virtual ::file::path roaming();
145 virtual ::file::path program_data();
146 virtual ::file::path application_data_base();
147 virtual ::file::path application_data();
148 virtual ::file::path application_data(const ::scoped_string & scopedstrAppId);
149 virtual ::file::path application_home();
150 virtual ::file::path application_home(const ::scoped_string & scopedstrAppId);
151 virtual ::file::path public_root(); // writable common root (non-bin, non-exe)
152 virtual ::file::path bookmark();
153 virtual ::file::path home();
154 virtual ::file::path icloud_container2(const_char_pointer pszContentIdentifier = nullptr);
155 virtual ::file::path icloud_container_documents(const_char_pointer pszContentIdentifier = nullptr);
156 virtual ::file::path icloud_container2_final(const_char_pointer pszContentIdentifier = nullptr);
157 virtual bool is_icloud_container(const ::file::path & path, const_char_pointer pszContentIdentifier = nullptr);
158 virtual bool has_icloud_container(const_char_pointer pszContentIdentifier = nullptr);
159 virtual ::file::path pathfind(const ::scoped_string & scopedstrEnv, const ::scoped_string & scopedstrTopic, const ::scoped_string & scopedstrMode);
160 virtual ::file::path program_files_x86();
161 virtual ::file::path program_files();
162 //virtual ::file::path program_data();
163 virtual ::file::path stage(const ::scoped_string & scopedstrAppId, const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
164 virtual ::file::path sys_temp();
165 virtual ::file::path temp();
166 virtual ::string dir_root();
167 //virtual ::file::path home();
168 //virtual ::file::path program_data();
169 //virtual ::file::path roaming();
170 virtual ::file::path get_memory_map_base_folder_path();
171 //virtual ::file::path ca2appdata();
172 //virtual ::file::path ca2roaming();
173 //virtual ::file::path localconfig();
174 virtual string system_short_name();
175
176
177 //::file::path inplace_install(const ::scoped_string & scopedstrAppId, const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
178 //virtual ::file::path inplace_install(const ::scoped_string & scopedstrAppId, const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
179 virtual ::file::path inplace_install(const ::scoped_string & scopedstrAppId, const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
180 virtual ::file::path inplace_matter_install(const ::scoped_string & scopedstrAppId, const ::scoped_string & scopedstrPlatform, const ::scoped_string & scopedstrConfiguration);
181
182
183 virtual void set_path_install_folder(const ::scoped_string & scopedstrPath);
184
185 //virtual ::file::path pathfind(const ::scoped_string & scopedstrEnv, const ::scoped_string & scopedstrTopic, const ::scoped_string & scopedstrMode);
186
187 virtual ::file::path machine_event_file_path();
188
189 virtual ::file::path user_appdata_local();
190 //virtual ::file::path tool();
191
192 inline ::i32_boolean is(const ::file::path& path) { return file_type(path) & ::file::e_type_folder2; }
193 inline ::i32_boolean __is(const ::file::path& path) { return __file_type(path) & ::file::e_type_folder2; }
194
195 virtual ::file::e_type file_type(const ::file::path& path);
196 virtual ::file::e_type _file_type(const ::file::path& path);
197 virtual ::file::e_type __file_type(const ::file::path& path);
198 // From acme/filesystem/file/dir.cpp by camilo
199 // From acme_posix/directory_system.h
200// on 2021-08-09 03:20 BRT
201// <3ThomasBorregaardSorensen!!
202
203
204 //namespace posix
205 //{
206
207
208 // class CLASS_DECL_ACME_POSIX directory_system :
209 // virtual public ::directory_system
210 // {
211
212 // public:
213
214 // directory_system();
215 // ~directory_system();
216
217 //virtual string name(const ::file::path & path1);
218
219
220 //virtual ::file::path base_module();
221
222 virtual void create(const ::file::path & path);
223 //virtual void _create(const ::file::path & path);
224 virtual void _create2(const ::file::path & path);
225 virtual void _create4(const ::file::path & path);
226 virtual void erase(const ::file::path & path);
227 virtual void erase_recursively(const ::file::path & path);
228
229
230 //virtual void enumerate_recursively(::file::path_array_base & stra, const ::scoped_string & scopedstr);
231 //virtual void enumerate_recursively_directory(::file::path_array_base & stra, const ::scoped_string & scopedstr);
232
233 //bool _enumerates(::file::listing_base & listing) override;
234
235 bool enumerate(::file::listing_base & listing) override;
236
237 virtual bool defer_enumerate_protocol(::file::listing_base& listing);
238
239 virtual bool defer_enumerate_media_library(::file::listing_base& listing);
240 virtual ::media_library::item* media_library_item(const ::file::path& path);
241 virtual bool defer_process_media_library_path(::file::path& path);
242 virtual bool defer_media_library_representative_file_name(::file::path & path);
243
244 bool list_base(::string_array_base & stra, const ::scoped_string & path, ::file::e_flag eflag = ::file::e_flag_file_or_folder) override;
245
246 virtual ::file::listing_base folders(const ::file::path & path) override;
247 virtual ::file::listing_base files(const ::file::path& path) override;
248 virtual ::file::listing_base folders_and_files(const ::file::path& path) override;
249
250
251 //virtual void enumerate(::file::listing_base & listing, const ::file::path & path, ::file::e_flag eflag = ::file::e_flag_none, enum_depth edepth = e_depth_none);
252 //virtual void enumerate_pattern(::file::listing_base & listing, const ::file::path & path, const ::string_array_base & straNamePattern, ::file::e_flag eflag = ::file::e_flag_none, enum_depth edepth = e_depth_none);
253 //virtual void enumerate_directory(::file::path_array_base & stra, const ::scoped_string & scopedstr, enum_depth edepth = e_depth_none);
254 //virtual void enumerate_file(::file::path_array_base & stra, const ::scoped_string & scopedstr, enum_depth edepth = e_depth_none);
255
256 virtual ::i32 make_path(const ::scoped_string & scopedstr);
257
258
259 /*namespace dir
260 {*/
261
262
263 //virtual string name(const ::file::path & path);
264 //virtual bool mk(const ::scoped_string & scopedstrPath);
265 //virtual bool _mk(const_char_pointer path); // makes a directory path (all intermediates too)
266 //virtual bool is(const ::file::path & path);
267 //virtual bool _is(const ::file::path & path);
268 //virtual bool mk(const_char_pointer path); // makes a directory path (all intermediates too)
269 //virtual bool mkdir(const_char_pointer path); // only creates if parent dir already exists
270 //virtual void ls(::file::path_array_base & patha, const ::file::path & path);
271 //virtual void ls_dir(::file::path_array_base & patha, const ::file::path & path);
272 //virtual void ls_file(::file::path_array_base & patha, const ::file::path & path);
273 //virtual void rls(::file::path_array_base & patha, const ::file::path & path);
274 //virtual void rls_dir(::file::path_array_base & patha, const ::file::path & path);
275
276
277 //virtual::file::path ca2_module();
278 //virtual::file::path base_module();
279
280
281 //} // namespace dir
282
283 virtual string_to_string_base map_content(const ::file::path & path);
284 virtual ::string_array_base enumerate_content(const ::file::path & path);
285
286
287
288
289 virtual ::file::path current();
290 virtual void change_current(const ::file::path & path);
291 virtual void set_current(const ::file::path& path);
292 virtual void change_to_home();
293
294
295 virtual void add_media_library_item(::media_library::item* pmedialibraryitem);
296
297
298 virtual ::file::path windows();
299 virtual ::file::path system_drive();
300
301 virtual ::file::path fonts();
302 virtual ::file::path ___fonts();
303
304
305 virtual bool is_accessible(const ::file::path & path);
306
307 virtual bool contains_files(const ::file::path& path, const ::string_array_base& straName, ::i32 iMinimumSize);
308
309
310 //virtual void initialize(::particle * pparticle) override;
311
312 virtual void init_system();
313
314 virtual void term_system();
315
316 void destroy() override;
317
318 virtual ::file::path compute_default_app_data_path();
319
320};
321
322
323
Definition aaa_dir_system.h:10
Definition enumerator.h:14
virtual void destroy() override
Definition bbb_context_object.cpp:242
Definition department.h:13