Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change #getTempPath:buffer: on WinPlatform to use ‘GetTempPathW’ instead of ‘GetTempPath2W’ #16342

Merged
merged 5 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/System-OSEnvironments-Tests/OSEnvironmentTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion src/System-OSEnvironments/OSEnvironment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion src/System-OSEnvironments/Win32Environment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
4 changes: 3 additions & 1 deletion src/System-Platforms-Tests/WinPlatformTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] ]
]
2 changes: 1 addition & 1 deletion src/System-Platforms/WinPlatform.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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))
]

Expand Down