1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/wince/direct.c
usa b369eea79f * file.c (utimbuf): use utimbuf instead of _utimbuf if defined _WIN32.
* win32/Makefile.sub (LIBS): use oldnames.lib.

* win32/win32.c (rb_w32_getcwd): follow above change.

* win32/win32.h: ditto.

* wince/direct.c, wince/direct.h (getcwd): ditto.

* wince/io.h: ditto.

* wince/string.c, wince/wince.h (stricmp, strnicmp): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-04 18:17:30 +00:00

54 lines
929 B
C

/***************************************************************
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;
}