Created
April 9, 2014 17:27
-
-
Save SaitoAtsushi/10294572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/libsys.scm b/src/libsys.scm | |
index 05333c9..9530891 100644 | |
--- a/src/libsys.scm | |
+++ b/src/libsys.scm | |
@@ -383,7 +383,9 @@ | |
(define-cproc sys-remove (filename::<const-cstring>) ::<void> | |
(let* ([r::int]) | |
- (SCM_SYSCALL r (remove filename)) | |
+ (.if "defined(GAUCHE_WINDOWS) && defined(UNICODE)" | |
+ (SCM_SYSCALL r (_wremove (Scm_MBS2WCS filename))) | |
+ (SCM_SYSCALL r (remove filename))) | |
(when (< r 0) (Scm_SysError "remove failed on %s" filename)))) | |
(define-cproc sys-rename (oldname::<const-cstring> | |
@@ -396,7 +398,9 @@ | |
;; We don't check and raise an error here, since the error will be | |
;; caught by rename() call. | |
(begin (chmod newname #o666) (unlink newname))) | |
- (SCM_SYSCALL r (rename oldname newname)) | |
+ (.if "defined(GAUCHE_WINDOWS) && defined(UNICODE)" | |
+ (SCM_SYSCALL r (_wrename (Scm_MBS2WCS oldname) (Scm_MBS2WCS newname))) | |
+ (SCM_SYSCALL r (rename oldname newname))) | |
(when (< r 0) (Scm_SysError "renaming %s to %s failed" oldname newname)))) | |
;; NB: Alghough tmpnam() is in POSIX, its use is discouraged because of | |
@@ -855,7 +859,9 @@ | |
(define-cproc sys-chdir (pathname::<const-cstring>) ::<void> | |
(let* ([r::int]) | |
- (SCM_SYSCALL r (chdir pathname)) | |
+ (.if "defined(GAUCHE_WINDOWS)" | |
+ (SCM_SYSCALL r (_wchdir (Scm_MBS2WCS pathname))) | |
+ (SCM_SYSCALL r (chdir pathname))) | |
(when (< r 0) (Scm_SysError "chdir failed")))) | |
(define-cproc sys-chmod (pathname::<const-cstring> mode::<int>) ::<void> | |
@@ -1114,7 +1120,9 @@ | |
;; an error here, since the error will be caught by next unlink call. | |
(when (not (access pathname F_OK)) | |
(chmod pathname #o600))) | |
- (SCM_SYSCALL r (unlink pathname)) | |
+ (.if "defined(GAUCHE_WINDOWS) && defined(UNICODE)" | |
+ (SCM_SYSCALL r (_wunlink (Scm_MBS2WCS pathname))) | |
+ (SCM_SYSCALL r (unlink pathname))) | |
(if (< r 0) | |
(begin | |
(unless (== errno ENOENT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment