aboutsummaryrefslogtreecommitdiffstats
path: root/wince/sys/stat.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-04 13:48:20 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-04 13:48:20 +0000
commita8c3540b32d7621c183627d7cc198f4b24798387 (patch)
tree602e5c4e6a866436cf999e994d4590df9c89fb2a /wince/sys/stat.c
parent642e08187927b2debaa0d84a112123043f0f7912 (diff)
downloadruby-a8c3540b32d7621c183627d7cc198f4b24798387.tar.gz
* dln.c: Ruby no longer supports Windows CE.
* eval.c: ditto. * include/ruby/defines.h: ditto. * include/ruby/win32.h: ditto. * ruby.c: ditto. * strftime.c: ditto. * win32/Makefile.sub: ditto. * win32/win32.c: ditto. * ext/tk/extconf.rb: ditto. * lib/fileutils.rb: ditto. * test/fileutils/test_fileutils.rb: ditto. * wince/*: removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'wince/sys/stat.c')
-rw-r--r--wince/sys/stat.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/wince/sys/stat.c b/wince/sys/stat.c
deleted file mode 100644
index 5d51dbf426..0000000000
--- a/wince/sys/stat.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/***************************************************************
- stat.c
-
- author : uema2
- date : Nov 30, 2002
-
- You can freely use, copy, modify, and redistribute
- the whole contents.
-***************************************************************/
-
-#include <windows.h>
-#include <sys/stat.h>
-#include <time.h>
-#include "..\wince.h" /* for wce_mbtowc */
-
-
-int _stat(const char *filename, struct _stat *st)
-{
- DWORD dwAttribute;
- HANDLE h;
- DWORD dwSizeLow=0, dwSizeHigh=0, dwError=0;
- WIN32_FIND_DATAW fd;
- wchar_t *wfilename;
-
-// wfilename = wce_mbtowc(filename);
- wfilename = wce_replaceRelativeDir(filename);
-
- dwAttribute = GetFileAttributesW(wfilename);
- if(dwAttribute==0xFFFFFFFF)
- {
- free(wfilename);
- return -1;
- }
-
- st->st_mode = 0;
- if((dwAttribute & FILE_ATTRIBUTE_DIRECTORY) != 0)
- st->st_mode += S_IFDIR;
- else
- st->st_mode += S_IFREG;
-
- /* initialize */
- st->st_atime = 0;
- st->st_mtime = 0;
- st->st_ctime = 0;
- st->st_size = 0;
- st->st_dev = 0;
-
- h = FindFirstFileW(wfilename, &fd);
- if(h == INVALID_HANDLE_VALUE)
- {
- if(wfilename[wcslen(wfilename)-1] == L'\\')
- {
- wfilename[wcslen(wfilename)-1] = L'\0';
- h = FindFirstFileW(wfilename, &fd);
- if(h == INVALID_HANDLE_VALUE)
- {
- free(wfilename);
- return 0;
- }
- }
- else
- {
- free(wfilename);
- return 0;
- }
- }
-
- /* FILETIME -> time_t */
- st->st_atime = wce_FILETIME2time_t(&fd.ftLastAccessTime);
- st->st_mtime = wce_FILETIME2time_t(&fd.ftLastWriteTime);
- st->st_ctime = wce_FILETIME2time_t(&fd.ftCreationTime);
- st->st_size = fd.nFileSizeLow;
-
- FindClose( h );
- free(wfilename);
- return 0;
-}
-
-int fstat(int file, struct stat *sbuf)
-{
- /* GetFileSize & GetFileTime */
- DWORD dwSize;
- FILETIME ctime, atime, mtime;
-
- dwSize = GetFileSize( (HANDLE)file, NULL );
- if( dwSize == 0xFFFFFFFF )
- return -1;
-
- sbuf->st_size = dwSize;
- sbuf->st_dev = 0;
- sbuf->st_rdev = 0;
- sbuf->st_mode = _S_IFREG;
- sbuf->st_nlink= 1;
-
- GetFileTime( (HANDLE)file, &ctime, &atime, &mtime );
- sbuf->st_ctime = wce_FILETIME2time_t(&ctime);
- sbuf->st_atime = wce_FILETIME2time_t(&atime);
- sbuf->st_mtime = wce_FILETIME2time_t(&mtime);
-
- return 0;
-}
-