summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-02-18 21:58:57 +0100
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-02-22 09:35:02 +0100
commit8c7ba8c3a31ec671ccd6d7d30682dbd631d69a62 (patch)
tree44a0765c48d0ba37df1c1b7be4a006dbccfa9948
parentc4f33c67a8d75888b21a0f464b0b1c82bd55bd0b (diff)
lets delete efl_vpath
Its not used anymore. ref T5314
-rw-r--r--src/Makefile_Efl.am9
-rw-r--r--src/lib/efl/Efl.h6
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c2
-rw-r--r--src/lib/efl/interfaces/efl_vpath.eo31
-rw-r--r--src/lib/efl/interfaces/efl_vpath_core.c436
-rw-r--r--src/lib/efl/interfaces/efl_vpath_core.eo33
-rw-r--r--src/lib/efl/interfaces/efl_vpath_file.c74
-rw-r--r--src/lib/efl/interfaces/efl_vpath_file.eo55
-rw-r--r--src/lib/efl/interfaces/efl_vpath_file_core.c66
-rw-r--r--src/lib/efl/interfaces/efl_vpath_file_core.eo14
-rw-r--r--src/lib/efl/interfaces/efl_vpath_manager.c88
-rw-r--r--src/lib/efl/interfaces/efl_vpath_manager.eo30
12 files changed, 0 insertions, 844 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 01b98ddfde..f98f554362 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -54,11 +54,6 @@ efl_eolian_files = \
54 lib/efl/interfaces/efl_pack_layout.eo \ 54 lib/efl/interfaces/efl_pack_layout.eo \
55 lib/efl/interfaces/efl_pack_linear.eo \ 55 lib/efl/interfaces/efl_pack_linear.eo \
56 lib/efl/interfaces/efl_pack_table.eo \ 56 lib/efl/interfaces/efl_pack_table.eo \
57 lib/efl/interfaces/efl_vpath.eo \
58 lib/efl/interfaces/efl_vpath_manager.eo \
59 lib/efl/interfaces/efl_vpath_file.eo \
60 lib/efl/interfaces/efl_vpath_core.eo \
61 lib/efl/interfaces/efl_vpath_file_core.eo \
62 lib/efl/interfaces/efl_ui_base.eo \ 57 lib/efl/interfaces/efl_ui_base.eo \
63 lib/efl/interfaces/efl_ui_direction.eo \ 58 lib/efl/interfaces/efl_ui_direction.eo \
64 lib/efl/interfaces/efl_ui_drag.eo \ 59 lib/efl/interfaces/efl_ui_drag.eo \
@@ -122,10 +117,6 @@ lib/efl/interfaces/efl_interfaces_main.c \
122lib/efl/interfaces/efl_model_common.c \ 117lib/efl/interfaces/efl_model_common.c \
123lib/efl/interfaces/efl_gfx_path.c \ 118lib/efl/interfaces/efl_gfx_path.c \
124lib/efl/interfaces/efl_gfx_shape.c \ 119lib/efl/interfaces/efl_gfx_shape.c \
125lib/efl/interfaces/efl_vpath_file.c \
126lib/efl/interfaces/efl_vpath_manager.c \
127lib/efl/interfaces/efl_vpath_core.c \
128lib/efl/interfaces/efl_vpath_file_core.c \
129lib/efl/interfaces/efl_input_device.c \ 120lib/efl/interfaces/efl_input_device.c \
130lib/efl/interfaces/efl_io_closer.c \ 121lib/efl/interfaces/efl_io_closer.c \
131lib/efl/interfaces/efl_io_positioner.c \ 122lib/efl/interfaces/efl_io_positioner.c \
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index ed7405ced8..2399c9c30b 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -62,12 +62,6 @@ typedef struct _Efl_Text_Annotate_Annotation Efl_Text_Annotate_Annotation;
62 62
63#include <Efl_Model_Common.h> 63#include <Efl_Model_Common.h>
64 64
65#include "interfaces/efl_vpath_file.eo.h"
66#include "interfaces/efl_vpath.eo.h"
67#include "interfaces/efl_vpath_core.eo.h"
68#include "interfaces/efl_vpath_manager.eo.h"
69#include "interfaces/efl_vpath_file_core.eo.h"
70
71/* Data types */ 65/* Data types */
72#include "interfaces/efl_gfx_types.eot.h" 66#include "interfaces/efl_gfx_types.eot.h"
73#include "interfaces/efl_ui_types.eot.h" 67#include "interfaces/efl_ui_types.eot.h"
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index d9b87634a6..cb1738e52b 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -46,8 +46,6 @@
46#include "interfaces/efl_canvas.eo.c" 46#include "interfaces/efl_canvas.eo.c"
47#include "interfaces/efl_canvas_pointer.eo.c" 47#include "interfaces/efl_canvas_pointer.eo.c"
48 48
49#include "interfaces/efl_vpath.eo.c"
50
51#include "interfaces/efl_screen.eo.c" 49#include "interfaces/efl_screen.eo.c"
52 50
53/* Packing & containers */ 51/* Packing & containers */
diff --git a/src/lib/efl/interfaces/efl_vpath.eo b/src/lib/efl/interfaces/efl_vpath.eo
deleted file mode 100644
index ca97f1b090..0000000000
--- a/src/lib/efl/interfaces/efl_vpath.eo
+++ /dev/null
@@ -1,31 +0,0 @@
1interface Efl.Vpath
2{
3 [[ VPath is the EFL "Virtual Path" system that maps paths and downloads
4
5 You can provide virtual paths common in unix shells like:
6 "~/file.jpg"
7 "~username/file.png"
8 And also other extended paths like:
9 "(:cache:)/file.png"
10 "(:videos:)/file.mp4"
11 ...
12 And in future:
13 "file:///blah.jpg"
14 "http://blah.com/file.jpg"
15 "https://blahblah.com/file.jpg"
16 "ssh://blahblah.com:~/file.jpg"
17 ...
18
19 @since 1.18
20 ]]
21 eo_prefix: efl_vpath;
22 methods {
23 fetch {
24 [[ Fetch a new Vpath File object from the Vpath system ]]
25 params {
26 path: string; [[ The input virtual file path to fetch ]]
27 }
28 return: Efl.Vpath.File @owned; [[ An object representing the file ]]
29 }
30 }
31}
diff --git a/src/lib/efl/interfaces/efl_vpath_core.c b/src/lib/efl/interfaces/efl_vpath_core.c
deleted file mode 100644
index d6b136374d..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_core.c
+++ /dev/null
@@ -1,436 +0,0 @@
1#include "config.h"
2#include "Efl.h"
3
4#ifdef HAVE_GETPWENT
5# include <sys/types.h>
6# include <pwd.h>
7#endif
8
9#include <sys/stat.h>
10#include <sys/types.h>
11#include <fcntl.h>
12#include <sys/stat.h>
13#include <unistd.h>
14
15#define MY_CLASS EFL_VPATH_CORE_CLASS
16
17typedef struct _Efl_Vpath_Core_Data Efl_Vpath_Core_Data;
18
19struct _Efl_Vpath_Core_Data
20{
21 Eina_Spinlock lock;
22 Eina_Hash *meta;
23};
24
25static Efl_Vpath_Core *vpath_core = NULL;
26
27EOLIAN static Efl_Object *
28_efl_vpath_core_efl_object_constructor(Eo *obj, Efl_Vpath_Core_Data *pd)
29{
30 char buf[PATH_MAX], bufhome[PATH_MAX];
31 const char *home, *s;
32
33 if (vpath_core) return NULL;
34 obj = efl_constructor(efl_super(obj, MY_CLASS));
35 pd->meta = eina_hash_string_superfast_new
36 ((Eina_Free_Cb)eina_stringshare_del);
37 eina_spinlock_new(&(pd->lock));
38
39 vpath_core = obj;
40
41 // $HOME / ~/ etc.
42 home = eina_environment_home_get();
43 if (!home)
44 {
45 /* Windows does not have getuid(), but home can't be NULL */
46#ifdef HAVE_GETEUID
47 uid_t uid = geteuid();
48 struct stat st;
49
50 snprintf(bufhome, sizeof(bufhome), "/tmp/%i", (int)uid);
51 if (mkdir(bufhome, S_IRUSR | S_IWUSR | S_IXUSR) < 0)
52 {
53 if (errno != EEXIST)
54 {
55 if (stat("/tmp", &st) == 0) home = "/tmp";
56 else home = "/";
57 }
58 }
59 if (stat(bufhome, &st) == 0) home = bufhome;
60 else
61 {
62 if (stat("/tmp", &st) == 0) home = "/tmp";
63 else home = "/";
64 }
65#else
66 home = "/";
67#endif
68 }
69 efl_vpath_core_meta_set(obj, "home", home);
70 // tmp dir - system wide
71 s = eina_environment_tmp_get();
72 efl_vpath_core_meta_set(obj, "tmp", s);
73
74# if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
75# define ENV_HOME_SET(_env, _dir, _meta) \
76 if ((getuid() != geteuid()) || (!(s = getenv(_env)))) { \
77 snprintf(buf, sizeof(buf), "%s/"_dir, home); s = buf; \
78 } efl_vpath_core_meta_set(obj, _meta, s);
79#else
80# define ENV_HOME_SET(_env, _dir, _meta) \
81 if (!(s = getenv(_env))) { \
82 snprintf(buf, sizeof(buf), "%s/"_dir, home); s = buf; \
83 } efl_vpath_core_meta_set(obj, _meta, s);
84#endif
85 // $XDG_DATA_HOME defines the base directory relative to which user
86 // specific data files should be stored. If $XDG_DATA_HOME is either
87 // not set or empty, a default equal to $HOME/.local/share should be
88 // used.
89 ENV_HOME_SET("XDG_DATA_HOME", ".local/share", "data");
90 // $XDG_CONFIG_HOME defines the base directory relative to which user
91 // specific configuration files should be stored. If $XDG_CONFIG_HOME
92 // is either not set or empty, a default equal to $HOME/.config should
93 // be used.
94 ENV_HOME_SET("XDG_CONFIG_HOME", ".config", "config");
95 // $XDG_CACHE_HOME defines the base directory relative to which
96 // user specific non-essential data files should be stored. If
97 // $XDG_CACHE_HOME is either not set or empty, a default equal to
98 // $HOME/.cache should be used.
99 ENV_HOME_SET("XDG_CACHE_HOME", ".cache", "cache");
100 // $XDG_RUNTIME_DIR defines the base directory relative to which
101 // user-specific non-essential runtime files and other file objects
102 // (such as sockets, named pipes, ...) should be stored. The
103 // directory MUST be owned by the user, and he MUST be the only one
104 // having read and write access to it. Its Unix access mode MUST
105 // be 0700.
106#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
107 if ((getuid() != geteuid()) || (!(s = getenv("XDG_RUNTIME_DIR"))))
108#else
109 if (!(s = getenv("XDG_RUNTIME_DIR")))
110#endif
111 {
112 struct stat st;
113 uid_t uid;
114
115#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
116 uid = getuid();
117 if (setuid(geteuid()) != 0)
118 {
119 fprintf(stderr,
120 "FATAL: Cannot setuid - errno=%i\n",
121 errno);
122 abort();
123 }
124#endif
125 // fallback - make ~/.run
126 snprintf(buf, sizeof(buf), "%s/.run", home);
127 if (mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR) == 0) s = buf;
128 else
129 {
130 if (errno == EEXIST)
131 {
132 if (stat(buf, &st) == 0)
133 {
134 // some sanity checks - but not for security
135 if (!(st.st_mode & S_IFDIR))
136 {
137 // fatal - exists but is not a dir
138 fprintf(stderr,
139 "FATAL: run dir '%s' exists but not a dir\n",
140 buf);
141 abort();
142 }
143#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
144 if (st.st_uid != geteuid())
145 {
146 // fatal - run dir doesn't belong to user
147 fprintf(stderr,
148 "FATAL: run dir '%s' not owned by uid %i\n",
149 buf, (int)geteuid());
150 abort();
151 }
152#endif
153 // we're ok
154 s = buf;
155 }
156 else
157 {
158 // fatal - we cant create our run dir in ~/
159 fprintf(stderr,
160 "FATAL: Cannot verify run dir '%s' errno=%i\n",
161 buf, errno);
162 abort();
163 }
164 }
165 else
166 {
167 // fatal - we cant create our run dir in ~/
168 fprintf(stderr,
169 "FATAL: Cannot create run dir '%s' - errno=%i\n",
170 buf, errno);
171 abort();
172 }
173 }
174#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
175 if (setreuid(uid, geteuid()) != 0)
176 {
177 fprintf(stderr,
178 "FATAL: Cannot setreuid - errno=%i\n",
179 errno);
180 abort();
181 };
182#endif
183 }
184 if (!s) s = (char *)efl_vpath_core_meta_get(obj, "tmp");
185 efl_vpath_core_meta_set(obj, "run", s);
186 // https://www.freedesktop.org/wiki/Software/xdg-user-dirs/
187 // https://wiki.archlinux.org/index.php/Xdg_user_directories
188 // ^^^^ we don't handle:
189 // /etc/xdg/user-dirs.conf
190 // /etc/xdg/user-dirs.defaults
191 // (:config:)/user-dirs.conf
192 // (:config:)/user-dirs.defaults
193
194 // $XDG_DESKTOP_DIR="$HOME/Desktop"
195 ENV_HOME_SET("XDG_DESKTOP_DIR", "Desktop", "desktop");
196 // $XDG_DOCUMENTS_DIR="$HOME/Documents"
197 ENV_HOME_SET("XDG_DOCUMENTS_DIR", "Documents", "documents");
198 // $XDG_DOWNLOAD_DIR="$HOME/Downloads"
199 ENV_HOME_SET("XDG_DOWNLOAD_DIR", "Downloads", "downloads");
200 // $XDG_MUSIC_DIR="$HOME/Music"
201 ENV_HOME_SET("XDG_MUSIC_DIR", "Music", "music");
202 // $XDG_PICTURES_DIR="$HOME/Pictures"
203 ENV_HOME_SET("XDG_PICTURES_DIR", "Pictures", "pictures");
204 // $XDG_PUBLICSHARE_DIR="$HOME/Public"
205 ENV_HOME_SET("XDG_PUBLIC_DIR", "Public", "public");
206 // $XDG_TEMPLATES_DIR="$HOME/.Templates"
207 ENV_HOME_SET("XDG_TEMPLATES_DIR", ".Templates", "templates");
208 // $XDG_VIDEOS_DIR="$HOME/Videos"
209 ENV_HOME_SET("XDG_VIDEOS_DIR", "Videos", "videos");
210
211 // Add ~/Applications for user-installed apps
212 ENV_HOME_SET("E_APPS_DIR", "Applications", "apps");
213
214 // XXX: do the below ... later
215 //
216 // FHS FOR APP:
217 // app.dir = PREFIX
218 // app.bin = PREFIX/bin
219 // app.lib = PREFIX/lib
220 // app.data = PREFIX/share/APPNAME
221 // app.locale = PREFIX/share/locale
222 //
223 // XXX: figure out how to merge these with XDG/FHS?
224 // Tizen:
225 // App Dir Structure:
226 // bin Executable binary pathOwner: Read
227 // lib Library pathOwner: Read
228 // data Used to store private data of an application.
229 // res Used to read resource files that are delivered with the application package.
230 // shared Parent directory of the data, res, and trusted sub-directories. Files in this directory cannot be delivered with the application package.Owner: Read
231 // shared/data Used to share data with other applications.
232 // shared/res Used to share resources with other applications. The resource files are delivered with the application package.
233 // shared/trusted Used to share data with family of trusted applications. The family applications signed with the same certificate can access data in the shared/trusted directory.
234 //
235 // XXX: figure out how to merge these with XDG?
236 // Media/...vvv
237 // Images Used for Image data.Read and Write
238 // Sounds Used for Sound data.
239 // Videos Used for Video data.
240 // Cameras Used for Camera pictures.
241 // Downloads Used for Downloaded data.
242 // Music Used for Music data.
243 // Documents Used for Documents.
244 // Others Used for other types.
245 // System Ringtones Used for System default ringtones.Read
246 //
247 // $TZ_SYS_HOME=/home
248 // $TZ_SYS_DB=/var/db
249 // $TZ_SYS_CONFIG=/var/kdb
250 // $TZ_SYS_CONFIG_VOLATILE=/run/kdb
251 // $TZ_SYS_APP=/usr/apps
252 // $TZ_SYS_DESKTOP_APP=/usr/share/applications
253 //
254 // $TS_USER_DB=<user_homeid>/.tizen/db
255 // $TZ_USER_CONFIG=<user_home_dir>/.tizen/kdb
256 // $TZ_USER_APP=<user_home_dir>/.tizen/apps
257 // $TZ_USER_DESKTOP_APP=<user_home_dir>/.tizen/desktop
258 // $TZ_USER_DOCUMENTS=<user_home_dir>/Documents
259 // $TZ_USER_PICTURES=<user_home_dir>/Pictures
260 // $TZ_USER_VIDEOS=<user_home_dir>/Videos
261 // $TZ_USER_MUSIC=<user_home_dir>/Music
262 // $TZ_USER_DOWNLOADS=<user_home_dir>/Downloads
263 // $TZ_USER_PUBLIC=<user_home_dir>/Public
264 return obj;
265}
266
267EOLIAN static void
268_efl_vpath_core_efl_object_destructor(Eo *obj, Efl_Vpath_Core_Data *pd)
269{
270 eina_hash_free(pd->meta);
271 pd->meta = NULL;
272 eina_spinlock_free(&(pd->lock));
273 if (vpath_core == obj) vpath_core = NULL;
274 efl_destructor(efl_super(obj, MY_CLASS));
275}
276
277EOLIAN static Efl_Vpath_Core *
278_efl_vpath_core_core_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
279{
280 // no locks here as we expect efl to init this early in main "thread"
281 if (!vpath_core) vpath_core = efl_add(EFL_VPATH_CORE_CLASS, NULL);
282 return vpath_core;
283}
284
285EOLIAN static const char *
286_efl_vpath_core_meta_get(Eo *obj EINA_UNUSED, Efl_Vpath_Core_Data *pd, const char *key)
287{
288 const char *meta;
289
290 if (!key) return NULL;
291 eina_spinlock_take(&(pd->lock));
292 meta = eina_hash_find(pd->meta, key);
293 eina_spinlock_release(&(pd->lock));
294 return meta;
295}
296
297EOLIAN static void
298_efl_vpath_core_meta_set(Eo *obj EINA_UNUSED, Efl_Vpath_Core_Data *pd, const char *key, const char *path)
299{
300 if (!key) return;
301 eina_spinlock_take(&(pd->lock));
302 if (path) eina_hash_add(pd->meta, key, eina_stringshare_add(path));
303 else eina_hash_del(pd->meta, key, NULL);
304 eina_spinlock_release(&(pd->lock));
305}
306
307EOLIAN static Efl_Vpath_File *
308_efl_vpath_core_efl_vpath_fetch(Eo *obj, Efl_Vpath_Core_Data *pd EINA_UNUSED, const char *path)
309{
310 Efl_Vpath_File_Core *file;
311
312 file = efl_add(EFL_VPATH_FILE_CORE_CLASS, obj);
313 efl_vpath_file_path_set(file, path);
314 // XXX: implement parse of path then look up in hash if not just create
315 // object where path and result are the same and return that with
316 // path set and result set to resolved path - return obj handler calls
317 // "do" on object to get the result inside fetched or failed callback.
318 // if it's a url then we need a new classs that overrides the do and
319 // begins a fetch and on finish calls the event cb or when wait is called
320 if (path)
321 {
322 /* FIXME: not working for WIndows */
323 // /* <- full path
324 if (path[0] == '/')
325 {
326 efl_vpath_file_result_set(file, path);
327 return file;
328 }
329 // .*
330 if (path[0] == '.')
331 {
332 // .[/]* <- current dir relative
333 if ((path[1] == '/') || (path[1] == 0))
334 {
335 efl_vpath_file_result_set(file, path);
336 return file;
337 }
338 // ..[/]* <- parent dir relative
339 if ((path[1] == '.') && ((path[2] == '/') || (path[2] == 0)))
340 {
341 efl_vpath_file_result_set(file, path);
342 return file;
343 }
344 }
345 // ~* ...
346 if (path[0] == '~')
347 {
348 // ~/ <- home directory
349 if (path[1] == '/')
350 {
351 char buf[PATH_MAX];
352 const char *home = efl_vpath_core_meta_get(obj, "home");
353
354 if (home)
355 {
356 snprintf(buf, sizeof(buf), "%s%s", home, path + 1);
357 efl_vpath_file_result_set(file, buf);
358 return file;
359 }
360 }
361#ifdef HAVE_GETPWENT
362 // ~username/ <- homedir of user "username"
363 else
364 {
365 const char *p;
366 struct passwd pwent, *pwent2 = NULL;
367 char *name, buf[PATH_MAX], pwbuf[8129];
368
369 for (p = path + 1; *p; p++)
370 {
371 if (*p =='/') break;
372 }
373 name = alloca(p - path);
374 strncpy(name, path + 1, p - path - 1);
375 name[p - path - 1] = 0;
376 if (!getpwnam_r(name, &pwent, pwbuf, sizeof(pwbuf), &pwent2))
377 {
378 if ((pwent2) && (pwent.pw_dir))
379 {
380 snprintf(buf, sizeof(buf), "%s%s", pwent.pw_dir, p);
381 efl_vpath_file_result_set(file, buf);
382 return file;
383 }
384 }
385 }
386#endif /* HAVE_GETPWENT */
387 }
388 // (:xxx:)/* ... <- meta hash table
389 if ((path[0] == '(') && (path[1] == ':'))
390 {
391 const char *p, *meta;
392 char *name, buf[PATH_MAX];
393 Eina_Bool found = EINA_FALSE;
394
395 for (p = path + 2; *p; p++)
396 {
397 if ((p[0] ==':') && (p[1] == ')') && (p[2] == '/'))
398 {
399 found = EINA_TRUE;
400 break;
401 }
402 }
403 if (found)
404 {
405 name = alloca(p - path);
406 strncpy(name, path + 2, p - path - 2);
407 name[p - path - 2] = 0;
408 eina_spinlock_take(&(pd->lock));
409 meta = eina_hash_find(pd->meta, name);
410 eina_spinlock_release(&(pd->lock));
411 if (meta)
412 {
413 snprintf(buf, sizeof(buf), "%s%s", meta, p + 2);
414 efl_vpath_file_result_set(file, buf);
415 return file;
416 }
417 }
418 }
419 // XXX: handle file:// urls locally...
420 // XXX: if its a remote url or zip file etc. where we need to
421 // keep tmp file around then we need to set keep to true
422 // efl_vpath_file_keept_set(file, EINA_TRUE);
423
424 // file:/// <- local file path uri
425 // file://localhost/ <- local file path uri
426 // file://hostname/ <- remove file path uri
427 // XXX: %c4,%17,%fe etc. are bytes escaped
428 // http://www.ietf.org/rfc/rfc2396.txt
429 // http://www.ietf.org/rfc/rfc1738.txt
430 // http://equinox-project.org/spec/file-uri-spec.txt
431 // http://en.wikipedia.org/wiki/File_URI_scheme
432 }
433 return file;
434}
435
436#include "interfaces/efl_vpath_core.eo.c"
diff --git a/src/lib/efl/interfaces/efl_vpath_core.eo b/src/lib/efl/interfaces/efl_vpath_core.eo
deleted file mode 100644
index 0e238a02a9..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_core.eo
+++ /dev/null
@@ -1,33 +0,0 @@
1class Efl.Vpath.Core (Efl.Object, Efl.Vpath)
2{
3 [[ Core EFL implementation of a Vpath system
4
5 @since 1.18
6 ]]
7 eo_prefix: efl_vpath_core;
8 methods {
9 core_get @class {
10 [[ This gets the global EFL Core Vpath class - only 1 - singleton ]]
11 return: Efl.Vpath.Core; [[ Get the singleton core vpath ]]
12 }
13 meta_set {
14 [[ A Meta key is a mapping from a virtual path to a real one ]]
15 params {
16 key: string; [[ The magic path key being looked up ]]
17 path: string; [[ The real path the key maps to ]]
18 }
19 }
20 meta_get {
21 [[ This returns the real path set for a Meta key, or NULL if not ]]
22 params {
23 key: string; [[ The magic path key being looked up ]]
24 }
25 return: string; [[Real file path]]
26 }
27 }
28 implements {
29 Efl.Object.constructor;
30 Efl.Object.destructor;
31 Efl.Vpath.fetch;
32 }
33}
diff --git a/src/lib/efl/interfaces/efl_vpath_file.c b/src/lib/efl/interfaces/efl_vpath_file.c
deleted file mode 100644
index 3e098828ed..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_file.c
+++ /dev/null
@@ -1,74 +0,0 @@
1#include "config.h"
2#include "Efl.h"
3
4#define MY_CLASS EFL_VPATH_FILE_CLASS
5
6typedef struct _Efl_Vpath_File_Data Efl_Vpath_File_Data;
7
8struct _Efl_Vpath_File_Data
9{
10 const char *path;
11 const char *result;
12 Eina_Bool called : 1;
13 Eina_Bool keep : 1;
14};
15
16EOLIAN static void
17_efl_vpath_file_path_set(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd, const char *path)
18{
19 eina_stringshare_replace(&(pd->path), path);
20}
21
22EOLIAN static const char *
23_efl_vpath_file_path_get(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
24{
25 return pd->path;
26}
27
28EOLIAN static void
29_efl_vpath_file_result_set(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd, const char *path)
30{
31 eina_stringshare_replace(&(pd->result), path);
32}
33
34EOLIAN static const char *
35_efl_vpath_file_result_get(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
36{
37 return pd->result;
38}
39
40EOLIAN static void
41_efl_vpath_file_keep_set(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd, Eina_Bool keep)
42{
43 pd->keep = keep;
44}
45
46EOLIAN static Eina_Bool
47_efl_vpath_file_keep_get(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
48{
49 return pd->keep;
50}
51
52EOLIAN static Eina_Bool
53_efl_vpath_file_do(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd)
54{
55 if (pd->called) return EINA_FALSE;
56 pd->called = EINA_TRUE;
57 efl_event_callback_call(obj, EFL_VPATH_FILE_EVENT_FETCHED, NULL);
58 return EINA_TRUE;
59}
60
61EOLIAN static void
62_efl_vpath_file_wait(Eo *obj EINA_UNUSED, Efl_Vpath_File_Data *pd EINA_UNUSED)
63{
64 if (!pd->called)
65 {
66 pd->called = EINA_TRUE;
67 if (pd->result)
68 efl_event_callback_call(obj, EFL_VPATH_FILE_EVENT_FETCHED, NULL);
69 else
70 efl_event_callback_call(obj, EFL_VPATH_FILE_EVENT_FAILED, NULL);
71 }
72}
73
74#include "interfaces/efl_vpath_file.eo.c"
diff --git a/src/lib/efl/interfaces/efl_vpath_file.eo b/src/lib/efl/interfaces/efl_vpath_file.eo
deleted file mode 100644
index 1568a3ea9c..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_file.eo
+++ /dev/null
@@ -1,55 +0,0 @@
1class Efl.Vpath.File (Efl.Object)
2{
3 [[ VPath File is an actual representation of a downloaded/mapped vpath file
4
5 Keep this object around for as long as you need to use the file as it
6 may have been downloaded and kept as a local temporary file and
7 deletion may remove it.
8
9 When you have a Vpath File object for the first time, call the do()
10 method on it to actually begin/do the mapping. From here the
11 fetched or failed event callbacks will be called, inside of which or
12 afterwards you can fetch the resulting local file path by getting the
13 result property.
14
15 @since 1.18
16 ]]
17 eo_prefix: efl_vpath_file;
18 methods {
19 @property path {
20 [[ The original source path provided to lookup/fetch from ]]
21 set {}
22 get {}
23 values {
24 path: string; [[ The input virtual path to a file ]]
25 }
26 }
27 @property result {
28 [[ The resulting real local file path to open/read ]]
29 set {}
30 get {}
31 values {
32 path: string; [[ The resulting destination file ]]
33 }
34 }
35 @property keep {
36 [[ If this object has to be kept for the usage of the result ]]
37 set {}
38 get {}
39 values {
40 keep: bool; [[ If the object neerds tobe kept around ]]
41 }
42 }
43 do {
44 [[ Actually begin the resolving here - emit event now or do later ]]
45 return: bool; [[ Result callback already called ]]
46 }
47 wait {
48 [[ If not fetched yet, wait until it is and call result cb ]]
49 }
50 }
51 events {
52 fetched; [[ File successfully mapped/fetched ]]
53 failed; [[ File fetch or mapping failed ]]
54 }
55}
diff --git a/src/lib/efl/interfaces/efl_vpath_file_core.c b/src/lib/efl/interfaces/efl_vpath_file_core.c
deleted file mode 100644
index e0328e7fb9..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_file_core.c
+++ /dev/null
@@ -1,66 +0,0 @@
1#include "config.h"
2#include "Efl.h"
3
4#define MY_CLASS EFL_VPATH_FILE_CORE_CLASS
5
6typedef struct _Efl_Vpath_File_Core_Data Efl_Vpath_File_Core_Data;
7
8struct _Efl_Vpath_File_Core_Data
9{
10 int dummy;
11};
12
13EOLIAN static Efl_Object *
14_efl_vpath_file_core_efl_object_constructor(Eo *obj, Efl_Vpath_File_Core_Data *pd)
15{
16 obj = efl_constructor(efl_super(obj, MY_CLASS));
17 pd->dummy = 0;
18 return obj;
19}
20
21EOLIAN static void
22_efl_vpath_file_core_efl_object_destructor(Eo *obj, Efl_Vpath_File_Core_Data *pd)
23{
24 pd->dummy = 0;
25 efl_destructor(efl_super(obj, MY_CLASS));
26}
27
28EOLIAN static Eina_Bool
29_efl_vpath_file_core_efl_vpath_file_do(Eo *obj, Efl_Vpath_File_Core_Data *pd)
30{
31 const char *path;
32
33 if (efl_vpath_file_result_get(obj))
34 return efl_vpath_file_do(efl_super(obj, MY_CLASS));
35 // vpath core didn't find a match, so it'ss likely a protocol like
36 // http:// etc. etc. so deal with that here
37 path = efl_vpath_file_path_get(obj);
38 if (path)
39 {
40 if ((!strncasecmp(path, "http://", 7)) ||
41 (!strncasecmp(path, "https://", 8)))
42 {
43 // XXX: handle urls --- need a loop object
44 }
45 }
46 // ...
47 pd->dummy = 0;
48
49 // not a magic path - just set result to path
50 efl_vpath_file_result_set(obj, efl_vpath_file_path_get(obj));
51 return efl_vpath_file_do(efl_super(obj, MY_CLASS));
52}
53
54EOLIAN static void
55_efl_vpath_file_core_efl_vpath_file_wait(Eo *obj, Efl_Vpath_File_Core_Data *pd)
56{
57 if (efl_vpath_file_result_get(obj))
58 {
59 efl_vpath_file_do(efl_super(obj, MY_CLASS));
60 return;
61 }
62 pd->dummy = 0;
63 // XXX: not found yet, so do what is necessary
64}
65
66#include "interfaces/efl_vpath_file_core.eo.c"
diff --git a/src/lib/efl/interfaces/efl_vpath_file_core.eo b/src/lib/efl/interfaces/efl_vpath_file_core.eo
deleted file mode 100644
index 6a627f032e..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_file_core.eo
+++ /dev/null
@@ -1,14 +0,0 @@
1class Efl.Vpath.File.Core (Efl.Vpath.File)
2{
3 [[ Core EFL implementation of a Vpath File
4
5 @since 1.18
6 ]]
7 eo_prefix: efl_vpath_file_core;
8 implements {
9 Efl.Object.constructor;
10 Efl.Object.destructor;
11 Efl.Vpath.File.do;
12 Efl.Vpath.File.wait;
13 }
14}
diff --git a/src/lib/efl/interfaces/efl_vpath_manager.c b/src/lib/efl/interfaces/efl_vpath_manager.c
deleted file mode 100644
index cae265c187..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_manager.c
+++ /dev/null
@@ -1,88 +0,0 @@
1#include "config.h"
2#include "Efl.h"
3
4#define MY_CLASS EFL_VPATH_MANAGER_CLASS
5
6typedef struct _Efl_Vpath_Manager_Data Efl_Vpath_Manager_Data;
7typedef struct _Efl_Vpath_Manager_Entry Efl_Vpath_Manager_Entry;
8
9struct _Efl_Vpath_Manager_Data
10{
11 Eina_List *list;
12};
13
14struct _Efl_Vpath_Manager_Entry
15{
16 Efl_Vpath *vpath;
17 int priority;
18};
19
20static Efl_Vpath_Manager_Data vpath_manager =
21{
22 NULL
23};
24
25EOLIAN static Efl_Vpath_File *
26_efl_vpath_manager_fetch(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, const char *path)
27{
28 Efl_Vpath_Manager_Entry *entry;
29 Eina_List *l;
30 Efl_Vpath_File *file;
31
32 EINA_LIST_FOREACH(vpath_manager.list, l, entry)
33 {
34 file = efl_vpath_fetch(entry->vpath, path);
35 if (file) return file;
36 }
37 file = efl_add(EFL_VPATH_FILE_CLASS, NULL);
38 if (file)
39 {
40 efl_vpath_file_path_set(file, path);
41 efl_vpath_file_result_set(file, path);
42 }
43 return file;
44}
45
46static int
47_register_sort_cb(Efl_Vpath_Manager_Entry *e1, Efl_Vpath_Manager_Entry *e2)
48{
49 // sort higher numbers first in list
50 return (e2->priority - e1->priority);
51}
52
53static void
54_cb_vpath_del(void *data, const Efl_Event *event)
55{
56 efl_vpath_manager_unregister(EFL_VPATH_MANAGER_CLASS, event->object);
57 efl_event_callback_del(event->object, EFL_EVENT_DEL, _cb_vpath_del, data);
58}
59
60EOLIAN static void
61_efl_vpath_manager_register(Eo *obj, void *pd EINA_UNUSED, int priority, Efl_Vpath *vpath)
62{
63 Efl_Vpath_Manager_Entry *entry = malloc(sizeof(Efl_Vpath_Manager_Entry));
64 entry->vpath = vpath;
65 entry->priority = priority;
66 efl_event_callback_add(vpath, EFL_EVENT_DEL, _cb_vpath_del, obj);
67 vpath_manager.list = eina_list_sorted_insert
68 (vpath_manager.list, EINA_COMPARE_CB(_register_sort_cb), entry);
69}
70
71EOLIAN static void
72_efl_vpath_manager_unregister(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Vpath *vpath)
73{
74 Efl_Vpath_Manager_Entry *entry;
75 Eina_List *l;
76
77 EINA_LIST_FOREACH(vpath_manager.list, l, entry)
78 {
79 if (entry->vpath == vpath)
80 {
81 vpath_manager.list = eina_list_remove_list(vpath_manager.list, l);
82 free(entry);
83 return;
84 }
85 }
86}
87
88#include "interfaces/efl_vpath_manager.eo.c"
diff --git a/src/lib/efl/interfaces/efl_vpath_manager.eo b/src/lib/efl/interfaces/efl_vpath_manager.eo
deleted file mode 100644
index e2d301634b..0000000000
--- a/src/lib/efl/interfaces/efl_vpath_manager.eo
+++ /dev/null
@@ -1,30 +0,0 @@
1class Efl.Vpath.Manager (Efl.Object)
2{
3 [[ Vpath Manager manages multiple VPath objects that remap/download
4
5 @since 1.18
6 ]]
7 eo_prefix: efl_vpath_manager;
8 methods {
9 fetch @class {
10 [[ This class function fetches a Vpath File given an input path ]]
11 params {
12 path: string; [[ The input virtual file path to fetch ]]
13 }
14 return: Efl.Vpath.File @owned; [[ An object representing the file ]]
15 }
16 register @class {
17 [[Register a vpath with the manager ]]
18 params {
19 priority: int; [[ Search order - higher values tried first ]]
20 vpath: Efl.Vpath @nonull; [[ A Vpath implementation object ]]
21 }
22 }
23 unregister @class {
24 [[ Unregister a vpath from the manager ]]
25 params {
26 vpath: Efl.Vpath @nonull; [[ A Vpath implementation object ]]
27 }
28 }
29 }
30}