Skip to content

Commit 4d9ea9f

Browse files
author
Johan Brichau
committed
Deprecate existing newTemporaryFileReference in favour of newTemporaryFile which returns a pathString consistent with other Grease file-handling methods
1 parent 788fa15 commit 4d9ea9f

File tree

10 files changed

+52
-11
lines changed

10 files changed

+52
-11
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
files
2+
newTemporaryFile
3+
"Create a new temporary file in the systems temp directory and answer its pathString.
4+
It is the users responsibility to delete or move the file, it will not be cleaned up automatically
5+
(unless the host system has a policy for it)."
6+
^ self subclassResponsibility
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
files
2+
newTemporaryFileNamed: aName
3+
"Create a new temporary file in the systems temp directory and answer its pathString.
4+
It is the users responsibility to delete or move the file, it will not be cleaned up automatically
5+
(unless the host system has a policy for it)."
6+
self subclassResponsibility

repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReference.st

Lines changed: 0 additions & 8 deletions
This file was deleted.

repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReferenceNamed..st

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
files
2+
newTemporaryFile
3+
4+
^ self newTemporaryFileNamed: UUID new greaseString
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
files
2+
newTemporaryFileNamed: aName
3+
4+
^ (FileLocator temp / aName) pathString

repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ newTemporaryFileReference
55
It is the users responsibility to delete or move the file,
66
it will not be cleaned up automatically (unless the host system
77
has a policy for it)."
8+
self
9+
greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReference'
10+
details: 'Use newTemporaryFile'.
811
^ self newTemporaryFileReferenceNamed: UUID new asString

repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ newTemporaryFileReferenceNamed: aName
55
It is the users responsibility to delete or move the file,
66
it will not be cleaned up automatically (unless the host system
77
has a policy for it)."
8+
self
9+
greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReferenceNamed:'
10+
details: 'Use newTemporaryFileNamed:'.
811
^ FileLocator temp / aName
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests-files
2+
testNewTemporaryFile
3+
4+
| temporaryFile |
5+
[
6+
temporaryFile := GRPlatform current newTemporaryFile.
7+
GRPlatform current
8+
writeFileStreamOn: temporaryFile
9+
do: [ :str | str nextPutAll: 'test temporary' ]
10+
binary: false.
11+
self assert: (GRPlatform current fileExists: temporaryFile)
12+
] ensure: [ GRPlatform current deleteFile: temporaryFile ].
13+
self deny: (GRPlatform current fileExists: temporaryFile)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests-files
2+
testNewTemporaryFileNamed
3+
4+
| temporaryFile |
5+
[
6+
temporaryFile := GRPlatform current newTemporaryFileNamed: 'test_temporary'.
7+
GRPlatform current
8+
writeFileStreamOn: temporaryFile
9+
do: [ :str | str nextPutAll: 'test temporary' ]
10+
binary: false.
11+
self assert: (GRPlatform current fileExists: temporaryFile)
12+
] ensure: [ GRPlatform current deleteFile: temporaryFile ].
13+
self deny: (GRPlatform current fileExists: temporaryFile)

0 commit comments

Comments
 (0)