summaryrefslogtreecommitdiff
path: root/wince/direct.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-02 07:57:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-02 07:57:17 +0000
commit90c4dae08fea47797b3ae574e5dfe35dc66f5631 (patch)
tree4198e3ccd0a5bab17db2a0f82ee7b6c643115c69 /wince/direct.c
parente193fd8d665567c7f3b827c21a1b77af43e2c391 (diff)
WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'wince/direct.c')
-rw-r--r--wince/direct.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/wince/direct.c b/wince/direct.c
new file mode 100644
index 0000000..6cffc40
--- /dev/null
+++ b/wince/direct.c
@@ -0,0 +1,54 @@
+/***************************************************************
+ direct.c
+***************************************************************/
+
+#include <windows.h>
+#include <tchar.h>
+#include <direct.h>
+#include "wince.h" /* for wce_mbtowc */
+
+/* global for chdir, getcwd */
+static char _currentdir[MAX_PATH+1];
+
+
+char *_getcwd(char* buffer, int maxlen)
+{
+ strcpy( buffer, _currentdir );
+ return buffer;
+}
+
+int _chdir(const char * dirname)
+{
+ if( MAX_PATH < strlen(dirname) )
+ return -1;
+
+ strcpy( _currentdir, dirname );
+ return 0;
+}
+
+int _rmdir(const char * dir)
+{
+ wchar_t *wdir;
+ BOOL rc;
+
+ /* replace with RemoveDirectory. */
+ wdir = wce_mbtowc(dir);
+ rc = RemoveDirectoryW(wdir);
+ free(wdir);
+
+ return rc==TRUE ? 0 : -1;
+}
+
+int _mkdir(const char * dir)
+{
+ wchar_t* wdir;
+ BOOL rc;
+
+ /* replace with CreateDirectory. */
+ wdir = wce_mbtowc(dir);
+ rc = CreateDirectoryW(wdir, NULL);
+ free(wdir);
+
+ return rc==TRUE ? 0 : -1;
+}
+