aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore_file/ecore_file.c
diff options
context:
space:
mode:
authordoursse <doursse>2008-05-26 05:16:34 +0000
committerdoursse <doursse@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2008-05-26 05:16:34 +0000
commitcc0ca9325ecd23d25a2d8511c9f5d2af9c275b96 (patch)
tree756d2493d85d4a4191264f1df91af21986533ea2 /legacy/ecore/src/lib/ecore_file/ecore_file.c
parentuse the c++ api (diff)
downloadefl-cc0ca9325ecd23d25a2d8511c9f5d2af9c275b96.tar.gz
integration of evil in ecore. It's compiling on windows and my ubuntu. The commit is big, please report any problem
SVN revision: 34671
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file.c128
1 files changed, 5 insertions, 123 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c
index c0298084f8..e99ff63206 100644
--- a/legacy/ecore/src/lib/ecore_file/ecore_file.c
+++ b/legacy/ecore/src/lib/ecore_file/ecore_file.c
@@ -2,7 +2,9 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
@@ -12,132 +14,13 @@
# include <features.h>
#endif
#include <ctype.h>
-#include "ecore_file_private.h"
#include <errno.h>
-#ifdef _WIN32
-# include <shlobj.h>
-# include <objidl.h>
-#endif /* _WIN32 */
+#include "ecore_file_private.h"
static int init = 0;
-#ifdef _WIN32
-
-/* FIXME: Windows has no symbolic link. */
-/* Nevertheless, it can create and read .lnk files */
-static int
-symlink(const char *oldpath, const char *newpath)
-{
- IShellLink *pISL;
- IShellLink **shell_link;
- IPersistFile *pIPF;
- IPersistFile **persit_file;
- wchar_t new_path[MB_CUR_MAX];
-
- /* Hack to cleanly remove a warning */
- if (FAILED(CoInitialize(NULL)))
- return -1;
-
- shell_link = &pISL;
- if (FAILED(CoCreateInstance(&CLSID_ShellLink,
- NULL,
- CLSCTX_INPROC_SERVER,
- &IID_IShellLink,
- (void **)shell_link)))
- goto no_instance;
-
- if (FAILED(pISL->lpVtbl->SetPath(pISL, oldpath)))
- goto no_setpath;
-
- /* Hack to cleanly remove a warning */
- persit_file = &pIPF;
- if (FAILED(pISL->lpVtbl->QueryInterface(pISL, &IID_IPersistFile, (void **)persit_file)))
- goto no_queryinterface;
-
- mbstowcs(new_path, newpath, MB_CUR_MAX);
- if (FAILED(pIPF->lpVtbl->Save(pIPF, new_path, FALSE)))
- goto no_save;
-
- pIPF->lpVtbl->Release(pIPF);
- pISL->lpVtbl->Release(pISL);
- CoUninitialize();
-
- return 0;
-
- no_save:
- pIPF->lpVtbl->Release(pIPF);
- no_queryinterface:
- no_setpath:
- pISL->lpVtbl->Release(pISL);
- no_instance:
- CoUninitialize();
- return -1;
-}
-
-static int
-readlink(const char *path, char *buf, size_t bufsiz)
-{
- IShellLink *pISL;
- IShellLink **shell_link;
- IPersistFile *pIPF;
- IPersistFile **persit_file;
- wchar_t old_path[MB_CUR_MAX];
- char new_path[MB_CUR_MAX];
- int length;
-
- /* Hack to cleanly remove a warning */
- if (FAILED(CoInitialize(NULL)))
- return -1;
-
- persit_file = &pIPF;
- if (FAILED(CoCreateInstance(&CLSID_ShellLink,
- NULL,
- CLSCTX_INPROC_SERVER,
- &IID_IPersistFile,
- (void **)persit_file)))
- goto no_instance;
-
- mbstowcs(old_path, path, MB_CUR_MAX);
- if (FAILED(pIPF->lpVtbl->Load(pIPF, old_path, STGM_READWRITE)))
- goto no_load;
-
- shell_link = &pISL;
- if (FAILED(pIPF->lpVtbl->QueryInterface(pIPF, &IID_IShellLink, (void **)shell_link)))
- goto no_queryinterface;
-
- if (FAILED(pISL->lpVtbl->GetPath(pISL, new_path, MB_CUR_MAX, NULL, 0)))
- goto no_getpath;
-
- length = strlen(new_path);
- if (length > bufsiz)
- length = bufsiz;
-
- memcpy(buf, new_path, length);
-
- pISL->lpVtbl->Release(pISL);
- pIPF->lpVtbl->Release(pIPF);
- CoUninitialize();
-
- return length;
-
- no_getpath:
- pISL->lpVtbl->Release(pISL);
- no_queryinterface:
- no_load:
- pIPF->lpVtbl->Release(pIPF);
- no_instance:
- CoUninitialize();
- return -1;
-}
-
-#define realpath(file_name, resolved_name) _fullpath((resolved_name), (file_name), PATH_MAX)
-
-#define mkdir(path, mode) _mkdir((path))
-
-#endif /* _WIN32 */
-
/* externally accessible functions */
/**
* Initialize Ecore_File and the services it will use. Call this function
@@ -242,9 +125,8 @@ ecore_file_is_dir(const char *file)
return 0;
}
-#ifndef _WIN32
static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
-#endif /* _WIN32 */
+
/**
* Create a new directory
* @param dir The name of the directory to create