-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
throw error when creating a duplicate temporary file
- Loading branch information
Showing
3 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
...ory/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
files | ||
newTemporaryFileNamed: aName | ||
|
||
^ (FileLocator temp / aName) pathString | ||
| newFile | | ||
newFile := FileLocator temp / aName. | ||
newFile exists ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. | ||
^ newFile pathString |
2 changes: 1 addition & 1 deletion
2
repository/Grease-Pharo100-Core.package/monticello.meta/categories.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SystemOrganization addCategory: #'Grease-Pharo100-Core'! | ||
self packageOrganizer ensurePackage: #'Grease-Pharo100-Core' withTags: #()! |
11 changes: 7 additions & 4 deletions
11
...tory/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
tests-files | ||
testNewTemporaryFileNamed | ||
|
||
| temporaryFile | | ||
| temporaryFile fileName | | ||
fileName := 'GRPlatformTestTemporaryFile'. | ||
[ | ||
temporaryFile := GRPlatform current newTemporaryFileNamed: 'test_temporary'. | ||
temporaryFile := GRPlatform current newTemporaryFileNamed: fileName. | ||
GRPlatform current | ||
writeFileStreamOn: temporaryFile | ||
do: [ :str | str nextPutAll: 'test temporary' ] | ||
binary: false. | ||
self assert: (GRPlatform current fileExists: temporaryFile) | ||
self assert: (GRPlatform current fileExists: temporaryFile). | ||
self should: [ GRPlatform current newTemporaryFileNamed: fileName ] raise: GRError. | ||
] ensure: [ GRPlatform current deleteFile: temporaryFile ]. | ||
self deny: (GRPlatform current fileExists: temporaryFile) | ||
self deny: (GRPlatform current fileExists: temporaryFile). | ||
|