File tree Expand file tree Collapse file tree 4 files changed +60
-2
lines changed Expand file tree Collapse file tree 4 files changed +60
-2
lines changed Original file line number Diff line number Diff line change
1
+ Wed Aug 9 13:24:25 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
2
+
3
+ * win32/win32.[ch]: emulate rename(2).
4
+
1
5
Mon Aug 7 13:59:12 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
2
6
3
7
* regex.c (re_match): check for stack depth was needed.
Original file line number Diff line number Diff line change 1
1
#define RUBY_VERSION "1.4.6"
2
- #define RUBY_RELEASE_DATE "2000-08-01 "
2
+ #define RUBY_RELEASE_DATE "2000-08-09 "
3
3
#define RUBY_VERSION_CODE 146
4
- #define RUBY_RELEASE_CODE 20000801
4
+ #define RUBY_RELEASE_CODE 20000809
Original file line number Diff line number Diff line change @@ -2371,3 +2371,51 @@ win32_getenv(const char *name)
2371
2371
2372
2372
return curitem ;
2373
2373
}
2374
+
2375
+ int
2376
+ myrename (const char * oldpath , const char * newpath )
2377
+ {
2378
+ int res = 0 ;
2379
+ int oldatts ;
2380
+ int newatts ;
2381
+
2382
+ oldatts = GetFileAttributes (oldpath );
2383
+ newatts = GetFileAttributes (newpath );
2384
+
2385
+ if (oldatts == -1 ) {
2386
+ printf ("file to move doesn't exist" );
2387
+ return -1 ;
2388
+ }
2389
+
2390
+ if (newatts != -1 && newatts & FILE_ATTRIBUTE_READONLY )
2391
+ SetFileAttributesA (newpath , newatts & ~ FILE_ATTRIBUTE_READONLY );
2392
+
2393
+ if (!MoveFile (oldpath , newpath ))
2394
+ res = -1 ;
2395
+
2396
+ if (res == 0 || (GetLastError () != ERROR_ALREADY_EXISTS
2397
+ && GetLastError () != ERROR_FILE_EXISTS ))
2398
+ goto done ;
2399
+
2400
+ if (IsWinNT ()) {
2401
+ if (MoveFileEx (oldpath , newpath , MOVEFILE_REPLACE_EXISTING ))
2402
+ res = 0 ;
2403
+ } else {
2404
+ for (;;) {
2405
+ if (!DeleteFile (newpath ) && GetLastError () != ERROR_FILE_NOT_FOUND )
2406
+ break ;
2407
+ else if (MoveFile (oldpath , newpath )) {
2408
+ res = 0 ;
2409
+ break ;
2410
+ }
2411
+ }
2412
+ }
2413
+
2414
+ done :
2415
+ if (res )
2416
+ errno = GetLastError ();
2417
+ else
2418
+ SetFileAttributes (newpath , oldatts );
2419
+
2420
+ return res ;
2421
+ }
Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ extern struct protoent * mygetprotobynumber(int);
200
200
extern struct servent * mygetservbyname (char * , char * );
201
201
extern struct servent * mygetservbyport (int , char * );
202
202
extern char * win32_getenv (const char * );
203
+ extern int myrename (const char * , const char * );
203
204
204
205
extern int chown (const char * , int , int );
205
206
extern int link (char * , char * );
@@ -401,4 +402,9 @@ extern char *mystrerror(int);
401
402
#endif
402
403
#define getenv win32_getenv
403
404
405
+ #ifdef rename
406
+ #undef rename
407
+ #endif
408
+ #define rename myrename
409
+
404
410
#endif
You can’t perform that action at this time.
0 commit comments