mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #39 from jbreeden/master
Correct File::NULL for Windows
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
class File
|
||||
module Constants
|
||||
NULL = "/dev/null"
|
||||
|
||||
RDONLY = 0
|
||||
WRONLY = 1
|
||||
RDWR = 2
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define NULL_FILE "NUL"
|
||||
#define UNLINK _unlink
|
||||
#define GETCWD _getcwd
|
||||
#define CHMOD(a, b) 0
|
||||
@@ -34,6 +35,7 @@
|
||||
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#define NULL_FILE "/dev/null"
|
||||
#include <unistd.h>
|
||||
#define UNLINK unlink
|
||||
#define GETCWD getcwd
|
||||
@@ -311,4 +313,5 @@ mrb_init_file(mrb_state *mrb)
|
||||
mrb_define_const(mrb, cnst, "LOCK_UN", mrb_fixnum_value(LOCK_UN));
|
||||
mrb_define_const(mrb, cnst, "LOCK_NB", mrb_fixnum_value(LOCK_NB));
|
||||
mrb_define_const(mrb, cnst, "SEPARATOR", mrb_str_new_cstr(mrb, FILE_SEPARATOR));
|
||||
mrb_define_const(mrb, cnst, "NULL", mrb_str_new_cstr(mrb, NULL_FILE));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user