From c54c2258374fc9fd9c3317374a6eecdaf56ff80a Mon Sep 17 00:00:00 2001 From: Kris <1611248+Rinzwind@users.noreply.github.com> Date: Sun, 24 Mar 2024 00:43:30 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Changed=20#getTempPath:buffer:=20on=20WinPl?= =?UTF-8?q?atform=20to=20use=20=E2=80=98GetTempPathW=E2=80=99=20instead=20?= =?UTF-8?q?of=20=E2=80=98GetTempPath2W=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/System-Platforms/WinPlatform.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System-Platforms/WinPlatform.class.st b/src/System-Platforms/WinPlatform.class.st index f0d77c0286d..924c267a6cf 100644 --- a/src/System-Platforms/WinPlatform.class.st +++ b/src/System-Platforms/WinPlatform.class.st @@ -86,7 +86,7 @@ WinPlatform >> getTempPath [ { #category : 'file paths' } WinPlatform >> getTempPath: bufferLength buffer: buffer [ - self ffiCall: #(long GetTempPath2W(long bufferLength, + self ffiCall: #(long GetTempPathW(long bufferLength, void* buffer)) ] From 2ab718df0205efb0aa6b9d99971da1f96d9eff04 Mon Sep 17 00:00:00 2001 From: Kris <1611248+Rinzwind@users.noreply.github.com> Date: Tue, 26 Mar 2024 23:34:05 +0100 Subject: [PATCH 2/5] Fixed #setEnv:value:during: on OSEnvironment to restore the old value of the variable. --- src/System-OSEnvironments/OSEnvironment.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System-OSEnvironments/OSEnvironment.class.st b/src/System-OSEnvironments/OSEnvironment.class.st index b6d03093d91..93bc5cb51de 100644 --- a/src/System-OSEnvironments/OSEnvironment.class.st +++ b/src/System-OSEnvironments/OSEnvironment.class.st @@ -262,7 +262,7 @@ OSEnvironment >> setEnv: nameString value: valueString during: aBlock [ aBlock value ] ensure: [ oldValue ifNil: [ self removeKey: nameString ] - ifNotNil: [ self setEnv: nameString value: valueString ] ] + ifNotNil: [ self setEnv: nameString value: oldValue ] ] ] { #category : 'accessing' } From 3b34f898daa99c85928f82d81bec0a9db90632e4 Mon Sep 17 00:00:00 2001 From: Kris <1611248+Rinzwind@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:59:05 +0100 Subject: [PATCH 3/5] =?UTF-8?q?Adapted=20#removeEnvironmentVariable:=20on?= =?UTF-8?q?=20Win32Environment=20to=20changes=20done=20in=20commit=2015c6c?= =?UTF-8?q?f46bf05b5fa=20(=E2=80=9C[=E2=80=A6]Activate=20strict=20FFI[?= =?UTF-8?q?=E2=80=A6]=E2=80=9D).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/System-OSEnvironments/Win32Environment.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System-OSEnvironments/Win32Environment.class.st b/src/System-OSEnvironments/Win32Environment.class.st index 791adcc15c2..fc1b5812995 100644 --- a/src/System-OSEnvironments/Win32Environment.class.st +++ b/src/System-OSEnvironments/Win32Environment.class.st @@ -121,7 +121,7 @@ Win32Environment >> keysAndValuesDo: aBlock [ { #category : 'private' } Win32Environment >> removeEnvironmentVariable: nameString [ - ^ self ffiCall: #( int SetEnvironmentVariableW ( Win32WideString nameString, 0 ) ) + ^ self ffiCall: #( int SetEnvironmentVariableW ( Win32WideString nameString, Win32WideString 0 ) ) ] { #category : 'accessing' } From 2d5123d2542ad8cd2ee6f2e38fbdfadc365488d1 Mon Sep 17 00:00:00 2001 From: Kris <1611248+Rinzwind@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:59:53 +0100 Subject: [PATCH 4/5] =?UTF-8?q?Fixed=20#testGetTempPathFromTMP=20on=20WinP?= =?UTF-8?q?latformTest=20to=20ensure=20=E2=80=98TMP=E2=80=99=20is=20remove?= =?UTF-8?q?d=20from=20the=20environment=20again=20if=20it=20was=20absent.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/System-Platforms-Tests/WinPlatformTest.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/System-Platforms-Tests/WinPlatformTest.class.st b/src/System-Platforms-Tests/WinPlatformTest.class.st index ec5ffa49b09..60cc2a79551 100644 --- a/src/System-Platforms-Tests/WinPlatformTest.class.st +++ b/src/System-Platforms-Tests/WinPlatformTest.class.st @@ -19,5 +19,7 @@ WinPlatformTest >> testGetTempPathFromTMP [ OSEnvironment current at: 'TMP' put: expected. actual := OSPlatform current getTempPath. self assert: actual equals: expected ] ensure: [ - value ifNotNil: [ OSEnvironment current at: 'TMP' put: value ] ] + value + ifNil: [ OSEnvironment current removeKey: 'TMP' ] + ifNotNil: [ OSEnvironment current at: 'TMP' put: value ] ] ] From cd217b01cbcd4e0595efa619b365cf53a618838b Mon Sep 17 00:00:00 2001 From: Kris <1611248+Rinzwind@users.noreply.github.com> Date: Wed, 27 Mar 2024 01:25:03 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Adapted=20#testSettingEnvValueDuringReverts?= =?UTF-8?q?ValueAfterDuringBlock=20on=20OSEnvironmentTest=20to=20changes?= =?UTF-8?q?=20done=20in=20commit=202ab718df0205efb0=20(=E2=80=9CFixed=20#s?= =?UTF-8?q?etEnv:value:during:=20on=20OSEnvironment=20to=20restore=20the?= =?UTF-8?q?=20[=E2=80=A6]=E2=80=9D).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/System-OSEnvironments-Tests/OSEnvironmentTest.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/System-OSEnvironments-Tests/OSEnvironmentTest.class.st b/src/System-OSEnvironments-Tests/OSEnvironmentTest.class.st index 3d64316db56..26fcf81eb0f 100644 --- a/src/System-OSEnvironments-Tests/OSEnvironmentTest.class.st +++ b/src/System-OSEnvironments-Tests/OSEnvironmentTest.class.st @@ -109,9 +109,11 @@ OSEnvironmentTest >> testSettingEnvValueDuringRevertsValueAfterDuringBlock [ envName := self envNameForTest. self instance setEnv: envName value: 'Before'. expected := 'After'. - self instance setEnv: envName value: expected during: [ ]. + self instance setEnv: envName value: expected during: [ + actual := self instance at: envName. + self assert: actual equals: expected ]. actual := self instance at: envName. - self assert: actual equals: expected + self assert: actual equals: 'Before' ] { #category : 'tests' }