--- a/Win32OperatingSystem.st Thu Nov 24 17:59:13 2016 +0100
+++ b/Win32OperatingSystem.st Fri Nov 25 12:23:14 2016 +0100
@@ -978,6 +978,7 @@
"Modified: 7.1.1997 / 19:36:11 / stefan"
! !
+
!Win32OperatingSystem class methodsFor:'OS signal constants'!
sigABRT
@@ -4998,63 +4999,56 @@
Returns true if successful, false if not"
%{
- int ret;
+ int success;
if (__isStringLike(oldPath) && __isStringLike(newPath)) {
#ifdef DO_WRAP_CALLS
- char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
-
- strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
- strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
-
- do {
- __threadErrno = 0;
- // do not cast to INT - will loose sign bit then!
- ret = STX_API_NOINT_CALL2("MoveFileA", MoveFileA, _oldPath, _newPath);
- } while ((ret == 0) && (__threadErrno == EINTR));
-#else
- __BEGIN_INTERRUPTABLE__
- do {
- __threadErrno = 0;
- ret = MoveFileA((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- } while ((ret == 0) && (__threadErrno == EINTR));
- __END_INTERRUPTABLE__
-
- if (ret == 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
+ char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
+
+ strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
+ strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
+
+ do {
+ __threadErrno = 0;
+ // do not cast to INT - will loose sign bit then!
+ success = STX_API_NOINT_CALL2("MoveFileA", MoveFileA, _oldPath, _newPath);
+ } while (!success && __threadErrno == EINTR);
+#else
+ __BEGIN_INTERRUPTABLE__
+ do {
+ __threadErrno = 0;
+ success = MoveFileA((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ } while (!success && __threadErrno == EINTR);
+ __END_INTERRUPTABLE__
#endif
} else {
- wchar_t _oldPathW[MAXPATHLEN], _newPathW[MAXPATHLEN];
-
- if (_makeWchar(oldPath, _oldPathW, sizeof(_oldPathW)) < 0
- || _makeWchar(newPath, _newPathW, sizeof(_newPathW)) < 0) {
- goto err;
- }
+ wchar_t _oldPathW[MAXPATHLEN], _newPathW[MAXPATHLEN];
+
+ if (_makeWchar(oldPath, _oldPathW, sizeof(_oldPathW)) < 0
+ || _makeWchar(newPath, _newPathW, sizeof(_newPathW)) < 0) {
+ goto err;
+ }
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- // do not cast to INT - will loose sign bit then!
- ret = STX_API_NOINT_CALL2( "MoveFileW", MoveFileW, _oldPathW, _newPathW);
- } while ((ret == 0) && (__threadErrno == EINTR));
-#else
- __BEGIN_INTERRUPTABLE__
- do {
- __threadErrno = 0;
- ret = MoveFileW(_oldPathW, _newPathW);
- } while ((ret == 0) && (__threadErrno == EINTR));
- __END_INTERRUPTABLE__
- if (ret == 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- RETURN(false);
- }
-#endif
- }
- if (ret == 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ do {
+ __threadErrno = 0;
+ // do not cast to INT - will loose sign bit then!
+ success = STX_API_NOINT_CALL2( "MoveFileW", MoveFileW, _oldPathW, _newPathW);
+ } while (!success && __threadErrno == EINTR);
+#else
+ __BEGIN_INTERRUPTABLE__
+ do {
+ __threadErrno = 0;
+ success = MoveFileW(_oldPathW, _newPathW);
+ } while (!success && __threadErrno == EINTR);
+ __END_INTERRUPTABLE__
+#endif
+ }
+ if (success) {
+ RETURN (true);
+ }
+
+ @global(LastErrorNumber) = __mkSmallInteger(__WIN32_ERR(GetLastError()));
+ RETURN (false);
err:;
%}.
@@ -5062,6 +5056,7 @@
"
OperatingSystem renameFile:'foo' to:'bar'
+ OperatingSystem renameFile:'c:\windows' to:'c:\win'
"
!