Merge pull request #7 from furunkel/master

Use _WIN32 and _WIN64 to detect Windows instead of RUBY_PLATFORM
This commit is contained in:
Tomoyuki Sahara
2015-06-02 09:27:33 +09:00
4 changed files with 10 additions and 63 deletions
+2 -11
View File
@@ -1,15 +1,6 @@
MRuby::Gem::Specification.new('mruby-dir') do |spec|
spec.license = 'MIT'
spec.authors = [ 'Internet Initiative Japan Inc.' ]
spec.license = 'MIT and MIT-like license'
spec.authors = [ 'Internet Initiative Japan Inc.', 'Kevlin Henney']
spec.cc.include_paths << "#{build.root}/src"
case RUBY_PLATFORM
when /mingw|mswin/
spec.license = 'MIT and MIT-like license'
spec.authors += [ 'Kevlin Henney' ]
spec.objs += Dir.glob("#{dir}/src/Win/*.{c,cpp,m,asm,S}").map { |f|
objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X"))
}
end
end
+7 -1
View File
@@ -8,7 +8,6 @@
*/
#include "dirent.h"
#include <errno.h>
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
#include <stdlib.h>
@@ -21,6 +20,11 @@ extern "C"
typedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */
struct dirent
{
char *d_name;
};
struct DIR
{
handle_type handle; /* -1 for failed rewind */
@@ -29,6 +33,8 @@ struct DIR
char *name; /* null-terminated char string */
};
typedef struct DIR DIR;
DIR *opendir(const char *name)
{
DIR *dir = 0;
-50
View File
@@ -1,50 +0,0 @@
#ifndef DIRENT_INCLUDED
#define DIRENT_INCLUDED
/*
Declaration of POSIX directory browsing functions and types for Win32.
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
History: Created March 1997. Updated June 2003.
Rights: See end of file.
*/
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct DIR DIR;
struct dirent
{
char *d_name;
};
DIR *opendir(const char *);
int closedir(DIR *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
/*
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose is hereby granted without fee, provided
that this copyright and permissions notice appear in all copies and
derivatives.
This software is supplied "as is" without express or implied warranty.
But that said, if there are any problems please get in touch.
*/
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -16,7 +16,7 @@
#define PATH_MAX MAX_PATH
#endif
#define S_ISDIR(B) ((B)&_S_IFDIR)
#include "Win/dirent.h"
#include "Win/dirent.c"
#include <direct.h>
#define rmdir _rmdir
#define getcwd _getcwd