From 788fa150afdc6d44d83bde34fcaed9f4f2e5f700 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sat, 3 Feb 2024 15:52:57 +0100 Subject: [PATCH 01/16] Added support for newTemporaryFileReference in GemStone versions higher than 3.3 --- .../instance/newTemporaryFileReference.st | 8 ++++++++ .../instance/newTemporaryFileReferenceNamed..st | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st create mode 100644 repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st diff --git a/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st b/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st new file mode 100644 index 00000000..a89cef9e --- /dev/null +++ b/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st @@ -0,0 +1,8 @@ +*grease-gemstone330-core +newTemporaryFileReference + "Create a new temporary file in the systems temp directory + and answer a reference to it. + It is the users responsibility to delete or move the file, + it will not be cleaned up automatically (unless the host system + has a policy for it)." + ^ self newTemporaryFileReferenceNamed: UUID new greaseString diff --git a/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st b/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st new file mode 100644 index 00000000..de9da1ec --- /dev/null +++ b/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st @@ -0,0 +1,8 @@ +*grease-gemstone330-core +newTemporaryFileReferenceNamed: aName + "Create a new temporary file in the systems temp directory + and answer a reference to it. + It is the users responsibility to delete or move the file, + it will not be cleaned up automatically (unless the host system + has a policy for it)." + ^ GsFile openWriteOnServer: '/tmp/', aName From 4d9ea9f26ec9f130c1b09fed367d75c41c70c4aa Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 09:25:16 +0100 Subject: [PATCH 02/16] Deprecate existing `newTemporaryFileReference` in favour of `newTemporaryFile` which returns a pathString consistent with other Grease file-handling methods --- .../GRPlatform.class/instance/newTemporaryFile.st | 6 ++++++ .../instance/newTemporaryFileNamed..st | 6 ++++++ .../instance/newTemporaryFileReference.st | 8 -------- .../instance/newTemporaryFileReferenceNamed..st | 3 --- .../instance/newTemporaryFile.st | 4 ++++ .../instance/newTemporaryFileNamed..st | 4 ++++ .../instance/newTemporaryFileReference.st | 3 +++ .../instance/newTemporaryFileReferenceNamed..st | 3 +++ .../instance/testNewTemporaryFile.st | 13 +++++++++++++ .../instance/testNewTemporaryFileNamed.st | 13 +++++++++++++ 10 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFile.st create mode 100644 repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileNamed..st delete mode 100644 repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReference.st delete mode 100644 repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReferenceNamed..st create mode 100644 repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st create mode 100644 repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st create mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st create mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFile.st b/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFile.st new file mode 100644 index 00000000..e92ccc4c --- /dev/null +++ b/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFile.st @@ -0,0 +1,6 @@ +files +newTemporaryFile + "Create a new temporary file in the systems temp directory and answer its pathString. + It is the users responsibility to delete or move the file, it will not be cleaned up automatically + (unless the host system has a policy for it)." + ^ self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..c03ea7f2 --- /dev/null +++ b/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileNamed..st @@ -0,0 +1,6 @@ +files +newTemporaryFileNamed: aName + "Create a new temporary file in the systems temp directory and answer its pathString. + It is the users responsibility to delete or move the file, it will not be cleaned up automatically + (unless the host system has a policy for it)." + self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReference.st b/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReference.st deleted file mode 100644 index 91961b92..00000000 --- a/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReference.st +++ /dev/null @@ -1,8 +0,0 @@ -files -newTemporaryFileReference - "Create a new temporary file in the systems temp directory - and answer a reference to it. - It is the users responsibility to delete or move the file, - it will not be cleaned up automatically (unless the host system - has a policy for it)." - ^ self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReferenceNamed..st b/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReferenceNamed..st deleted file mode 100644 index 93059d5f..00000000 --- a/repository/Grease-Core.package/GRPlatform.class/instance/newTemporaryFileReferenceNamed..st +++ /dev/null @@ -1,3 +0,0 @@ -files -newTemporaryFileReferenceNamed: aName - self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st new file mode 100644 index 00000000..01578607 --- /dev/null +++ b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st @@ -0,0 +1,4 @@ +files +newTemporaryFile + + ^ self newTemporaryFileNamed: UUID new greaseString \ No newline at end of file diff --git a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..5e778cdd --- /dev/null +++ b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st @@ -0,0 +1,4 @@ +files +newTemporaryFileNamed: aName + + ^ (FileLocator temp / aName) pathString \ No newline at end of file diff --git a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st index cd503715..7992374f 100644 --- a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st +++ b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st @@ -5,4 +5,7 @@ newTemporaryFileReference It is the users responsibility to delete or move the file, it will not be cleaned up automatically (unless the host system has a policy for it)." + self + greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReference' + details: 'Use newTemporaryFile'. ^ self newTemporaryFileReferenceNamed: UUID new asString \ No newline at end of file diff --git a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st index 5f4d0602..81baa7c1 100644 --- a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st +++ b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st @@ -5,4 +5,7 @@ newTemporaryFileReferenceNamed: aName It is the users responsibility to delete or move the file, it will not be cleaned up automatically (unless the host system has a policy for it)." + self + greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReferenceNamed:' + details: 'Use newTemporaryFileNamed:'. ^ FileLocator temp / aName \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st new file mode 100644 index 00000000..f02a8289 --- /dev/null +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st @@ -0,0 +1,13 @@ +tests-files +testNewTemporaryFile + + | temporaryFile | + [ + temporaryFile := GRPlatform current newTemporaryFile. + GRPlatform current + writeFileStreamOn: temporaryFile + do: [ :str | str nextPutAll: 'test temporary' ] + binary: false. + self assert: (GRPlatform current fileExists: temporaryFile) + ] ensure: [ GRPlatform current deleteFile: temporaryFile ]. + self deny: (GRPlatform current fileExists: temporaryFile) \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st new file mode 100644 index 00000000..68d6ff3c --- /dev/null +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st @@ -0,0 +1,13 @@ +tests-files +testNewTemporaryFileNamed + + | temporaryFile | + [ + temporaryFile := GRPlatform current newTemporaryFileNamed: 'test_temporary'. + GRPlatform current + writeFileStreamOn: temporaryFile + do: [ :str | str nextPutAll: 'test temporary' ] + binary: false. + self assert: (GRPlatform current fileExists: temporaryFile) + ] ensure: [ GRPlatform current deleteFile: temporaryFile ]. + self deny: (GRPlatform current fileExists: temporaryFile) \ No newline at end of file From 0176ed2fb0619de39cc60437d4c60d0513f6e381 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 09:39:26 +0100 Subject: [PATCH 03/16] added temporary file creation methods to older Pharo versions --- .../GRPharoPlatform.class/instance/newTemporaryFile.st | 4 ++++ .../GRPharoPlatform.class/instance/newTemporaryFileNamed..st | 4 ++++ .../instance/newTemporaryFileReference.st | 3 +++ .../instance/newTemporaryFileReferenceNamed..st | 3 +++ .../GRPharoPlatform.class/instance/newTemporaryFile.st | 4 ++++ .../GRPharoPlatform.class/instance/newTemporaryFileNamed..st | 4 ++++ .../instance/newTemporaryFileReference.st | 3 +++ .../instance/newTemporaryFileReferenceNamed..st | 3 +++ 8 files changed, 28 insertions(+) create mode 100644 repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st create mode 100644 repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st create mode 100644 repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st create mode 100644 repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st diff --git a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st new file mode 100644 index 00000000..01578607 --- /dev/null +++ b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st @@ -0,0 +1,4 @@ +files +newTemporaryFile + + ^ self newTemporaryFileNamed: UUID new greaseString \ No newline at end of file diff --git a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..5e778cdd --- /dev/null +++ b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st @@ -0,0 +1,4 @@ +files +newTemporaryFileNamed: aName + + ^ (FileLocator temp / aName) pathString \ No newline at end of file diff --git a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st index ce7f6f18..63358983 100644 --- a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st +++ b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st @@ -5,4 +5,7 @@ newTemporaryFileReference It is the users responsibility to delete or move the file, it will not be cleaned up automatically (unless the host system has a policy for it)." + self + greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReference' + details: 'Use newTemporaryFile'. ^ self newTemporaryFileReferenceNamed: UUID new asString \ No newline at end of file diff --git a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st index f0fdf80f..d9eed8ee 100644 --- a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st +++ b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st @@ -5,4 +5,7 @@ newTemporaryFileReferenceNamed: aName It is the users responsibility to delete or move the file, it will not be cleaned up automatically (unless the host system has a policy for it)." + self + greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReferenceNamed:' + details: 'Use newTemporaryFileNamed:'. ^ FileLocator temp / aName \ No newline at end of file diff --git a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st new file mode 100644 index 00000000..01578607 --- /dev/null +++ b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFile.st @@ -0,0 +1,4 @@ +files +newTemporaryFile + + ^ self newTemporaryFileNamed: UUID new greaseString \ No newline at end of file diff --git a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..5e778cdd --- /dev/null +++ b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st @@ -0,0 +1,4 @@ +files +newTemporaryFileNamed: aName + + ^ (FileLocator temp / aName) pathString \ No newline at end of file diff --git a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st index cd503715..7992374f 100644 --- a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st +++ b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReference.st @@ -5,4 +5,7 @@ newTemporaryFileReference It is the users responsibility to delete or move the file, it will not be cleaned up automatically (unless the host system has a policy for it)." + self + greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReference' + details: 'Use newTemporaryFile'. ^ self newTemporaryFileReferenceNamed: UUID new asString \ No newline at end of file diff --git a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st index 5f4d0602..81baa7c1 100644 --- a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st +++ b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileReferenceNamed..st @@ -5,4 +5,7 @@ newTemporaryFileReferenceNamed: aName It is the users responsibility to delete or move the file, it will not be cleaned up automatically (unless the host system has a policy for it)." + self + greaseDeprecatedApi: 'GRPlatform>>newTemporaryFileReferenceNamed:' + details: 'Use newTemporaryFileNamed:'. ^ FileLocator temp / aName \ No newline at end of file From c83bb49c5012e2dcaeaa73c1e2620f8abfdae37c Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 09:58:28 +0100 Subject: [PATCH 04/16] added new temporary file creation methods to GemStone --- .../instance/newTemporaryFile.st | 4 ++++ .../instance/newTemporaryFileNamed..st | 4 ++++ .../instance/newTemporaryFileReference.st | 8 -------- .../instance/newTemporaryFileReferenceNamed..st | 8 -------- 4 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st create mode 100644 repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st delete mode 100644 repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st delete mode 100644 repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st diff --git a/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st b/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st new file mode 100644 index 00000000..9c7dcae5 --- /dev/null +++ b/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st @@ -0,0 +1,4 @@ +*grease-gemstone300-core +newTemporaryFile + + ^ self newTemporaryFileNamed: UUID new greaseString diff --git a/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st b/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..c41ed58e --- /dev/null +++ b/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st @@ -0,0 +1,4 @@ +*grease-gemstone300-core +newTemporaryFileNamed: aName + + ^ (GsFile openWriteOnServer: '/tmp/', aName) pathName diff --git a/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st b/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st deleted file mode 100644 index a89cef9e..00000000 --- a/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReference.st +++ /dev/null @@ -1,8 +0,0 @@ -*grease-gemstone330-core -newTemporaryFileReference - "Create a new temporary file in the systems temp directory - and answer a reference to it. - It is the users responsibility to delete or move the file, - it will not be cleaned up automatically (unless the host system - has a policy for it)." - ^ self newTemporaryFileReferenceNamed: UUID new greaseString diff --git a/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st b/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st deleted file mode 100644 index de9da1ec..00000000 --- a/repository/Grease-GemStone330-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileReferenceNamed..st +++ /dev/null @@ -1,8 +0,0 @@ -*grease-gemstone330-core -newTemporaryFileReferenceNamed: aName - "Create a new temporary file in the systems temp directory - and answer a reference to it. - It is the users responsibility to delete or move the file, - it will not be cleaned up automatically (unless the host system - has a policy for it)." - ^ GsFile openWriteOnServer: '/tmp/', aName From acf57600216910eb04d8fc5a987f57d19ccaa4ad Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 10:09:40 +0100 Subject: [PATCH 05/16] moved method to GemStone-Core package and implemented missing deleteFile: method --- .../GRGemStonePlatform.class/instance/deleteFile..st | 4 ++++ .../GRGemStonePlatform.class}/instance/newTemporaryFile.st | 2 +- .../instance/newTemporaryFileNamed..st | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/deleteFile..st rename repository/{Grease-GemStone300-Core.package/GRGemStonePlatform.extension => Grease-GemStone-Core.package/GRGemStonePlatform.class}/instance/newTemporaryFile.st (73%) rename repository/{Grease-GemStone300-Core.package/GRGemStonePlatform.extension => Grease-GemStone-Core.package/GRGemStonePlatform.class}/instance/newTemporaryFileNamed..st (77%) diff --git a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/deleteFile..st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/deleteFile..st new file mode 100644 index 00000000..5959876d --- /dev/null +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/deleteFile..st @@ -0,0 +1,4 @@ +files +deleteFile: aPathString + + GsFile removeServerFile: aPathString diff --git a/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFile.st similarity index 73% rename from repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st rename to repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFile.st index 9c7dcae5..c452c26b 100644 --- a/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFile.st +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFile.st @@ -1,4 +1,4 @@ -*grease-gemstone300-core +files newTemporaryFile ^ self newTemporaryFileNamed: UUID new greaseString diff --git a/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st similarity index 77% rename from repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st rename to repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st index c41ed58e..46483c70 100644 --- a/repository/Grease-GemStone300-Core.package/GRGemStonePlatform.extension/instance/newTemporaryFileNamed..st +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,4 @@ -*grease-gemstone300-core +files newTemporaryFileNamed: aName ^ (GsFile openWriteOnServer: '/tmp/', aName) pathName From 602230d111a3131af35e629990590c0f943108c4 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 10:20:56 +0100 Subject: [PATCH 06/16] added file methods for Squeak 6 --- .../GRSqueakPlatform.class/instance/newTemporaryFile.st | 4 ++++ .../GRSqueakPlatform.class/instance/newTemporaryFileNamed..st | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st create mode 100644 repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st new file mode 100644 index 00000000..01578607 --- /dev/null +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st @@ -0,0 +1,4 @@ +files +newTemporaryFile + + ^ self newTemporaryFileNamed: UUID new greaseString \ No newline at end of file diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..cd8669c0 --- /dev/null +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st @@ -0,0 +1,4 @@ +files +newTemporaryFileNamed: aName + + ^ (FileDirectory default / aName) pathName \ No newline at end of file From 454b8de660f9262349af384f21d55f5fddd2ae89 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 10:22:34 +0100 Subject: [PATCH 07/16] Also add temporary file creation methods to Squeak 5 --- .../GRSqueakPlatform.class/instance/newTemporaryFile.st | 4 ++++ .../GRSqueakPlatform.class/instance/newTemporaryFileNamed..st | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st create mode 100644 repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st diff --git a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st new file mode 100644 index 00000000..01578607 --- /dev/null +++ b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFile.st @@ -0,0 +1,4 @@ +files +newTemporaryFile + + ^ self newTemporaryFileNamed: UUID new greaseString \ No newline at end of file diff --git a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st new file mode 100644 index 00000000..cd8669c0 --- /dev/null +++ b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st @@ -0,0 +1,4 @@ +files +newTemporaryFileNamed: aName + + ^ (FileDirectory default / aName) pathName \ No newline at end of file From 34bd7c337540d7272fb776f6217b8a20658f13a5 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 10:30:51 +0100 Subject: [PATCH 08/16] added deleteFile: to Squeak --- .../GRSqueakPlatform.class/instance/deleteFile..st | 3 +++ .../GRSqueakPlatform.class/instance/deleteFile..st | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/deleteFile..st create mode 100644 repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/deleteFile..st diff --git a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/deleteFile..st b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/deleteFile..st new file mode 100644 index 00000000..d03eee50 --- /dev/null +++ b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/deleteFile..st @@ -0,0 +1,3 @@ +files +deleteFile: aPathString + FileDirectory deleteFilePath: aPathString \ No newline at end of file diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/deleteFile..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/deleteFile..st new file mode 100644 index 00000000..d03eee50 --- /dev/null +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/deleteFile..st @@ -0,0 +1,3 @@ +files +deleteFile: aPathString + FileDirectory deleteFilePath: aPathString \ No newline at end of file From f7d355f105cb958e9433b0bfbc59dbf33edbe898 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 10:33:20 +0100 Subject: [PATCH 09/16] fix missing method in Squeak 6 --- .../instance/writeFileStreamOn.do.binary..st | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st new file mode 100644 index 00000000..1207150a --- /dev/null +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st @@ -0,0 +1,8 @@ +as yet unclassified +writeFileStreamOn: aString do: aBlock binary: aBoolean + | stream | + stream := aBoolean + ifTrue: [ (MultiByteFileStream fileNamed: aString) ascii; wantsLineEndConversion: true; yourself ] + ifFalse: [ (FileStream fileNamed: aString) binary ]. + [ aBlock value: stream ] + ensure: [ stream close ] \ No newline at end of file From f20c01fb2dff0b23d64199418fc732bcba1ec8c0 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 12:22:14 +0100 Subject: [PATCH 10/16] Test unique name of two generated temporary files --- .../instance/testNewTemporaryFile.st | 19 +++++++++++++------ .../monticello.meta/categories.st | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st index f02a8289..a4c49df3 100644 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFile.st @@ -1,13 +1,20 @@ tests-files testNewTemporaryFile - | temporaryFile | + | temporaryFile1 temporaryFile2 | [ - temporaryFile := GRPlatform current newTemporaryFile. + temporaryFile1 := GRPlatform current newTemporaryFile. + temporaryFile2 := GRPlatform current newTemporaryFile. GRPlatform current - writeFileStreamOn: temporaryFile + writeFileStreamOn: temporaryFile1 do: [ :str | str nextPutAll: 'test temporary' ] binary: false. - self assert: (GRPlatform current fileExists: temporaryFile) - ] ensure: [ GRPlatform current deleteFile: temporaryFile ]. - self deny: (GRPlatform current fileExists: temporaryFile) \ No newline at end of file + GRPlatform current + writeFileStreamOn: temporaryFile2 + do: [ :str | str nextPutAll: #[116 101 115 116 32 116 101 109 112 111 114 97 114 121] ] + binary: true. + self assert: (GRPlatform current fileExists: temporaryFile1). + self deny: (GRPlatform current localNameOf: temporaryFile1) equals: (GRPlatform current localNameOf: temporaryFile2) + ] ensure: [ GRPlatform current deleteFile: temporaryFile1. GRPlatform current deleteFile: temporaryFile2 ]. + self deny: (GRPlatform current fileExists: temporaryFile1). + self deny: (GRPlatform current fileExists: temporaryFile2) \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/monticello.meta/categories.st b/repository/Grease-Tests-Core.package/monticello.meta/categories.st index ee8a55f5..7e8202de 100644 --- a/repository/Grease-Tests-Core.package/monticello.meta/categories.st +++ b/repository/Grease-Tests-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Grease-Tests-Core'! +self packageOrganizer ensurePackage: #'Grease-Tests-Core' withTags: #()! From e628eef8cf0b2226cdddf2148a430efba02c3aa6 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 12:24:36 +0100 Subject: [PATCH 11/16] Fix writeFileStreamOn:do:binary: in Squeak --- .../instance/writeFileStreamOn.do.binary..st | 6 +++--- .../instance/writeFileStreamOn.do.binary..st | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st index 1207150a..9207976d 100644 --- a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st +++ b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st @@ -1,8 +1,8 @@ -as yet unclassified +files writeFileStreamOn: aString do: aBlock binary: aBoolean | stream | stream := aBoolean - ifTrue: [ (MultiByteFileStream fileNamed: aString) ascii; wantsLineEndConversion: true; yourself ] - ifFalse: [ (FileStream fileNamed: aString) binary ]. + ifTrue: [ (FileStream fileNamed: aString) binary ] + ifFalse: [ (MultiByteFileStream fileNamed: aString) ascii; wantsLineEndConversion: true; yourself ]. [ aBlock value: stream ] ensure: [ stream close ] \ No newline at end of file diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st index 1207150a..9207976d 100644 --- a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/writeFileStreamOn.do.binary..st @@ -1,8 +1,8 @@ -as yet unclassified +files writeFileStreamOn: aString do: aBlock binary: aBoolean | stream | stream := aBoolean - ifTrue: [ (MultiByteFileStream fileNamed: aString) ascii; wantsLineEndConversion: true; yourself ] - ifFalse: [ (FileStream fileNamed: aString) binary ]. + ifTrue: [ (FileStream fileNamed: aString) binary ] + ifFalse: [ (MultiByteFileStream fileNamed: aString) ascii; wantsLineEndConversion: true; yourself ]. [ aBlock value: stream ] ensure: [ stream close ] \ No newline at end of file From 17da9325d3e7104ac0dbf40ff91ab31dafca0e27 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 12:46:43 +0100 Subject: [PATCH 12/16] Refactor test for write:toFile:inFolder: --- .../testReadWriteEmptyFileInFolderBinary.st | 8 ------ .../testReadWriteEmptyFileInFolderText.st | 8 ------ .../testReadWriteToFileInFolderBinary.st | 8 ------ .../testReadWriteToFileInFolderText.st | 8 ------ .../instance/testWriteToFileInFolder.st | 27 +++++++++++++++++++ 5 files changed, 27 insertions(+), 32 deletions(-) delete mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderBinary.st delete mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderText.st delete mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderBinary.st delete mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderText.st create mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testWriteToFileInFolder.st diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderBinary.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderBinary.st deleted file mode 100644 index 39fbdb1c..00000000 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderBinary.st +++ /dev/null @@ -1,8 +0,0 @@ -tests-filestreams -testReadWriteEmptyFileInFolderBinary - | bytes | - bytes := ByteArray new. - self - writeToFile: bytes - withFileNameDo:[ :fileName | - self assert: (bytes = (GRPlatform current contentsOfFile: fileName binary: true)) ] \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderText.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderText.st deleted file mode 100644 index 757a5cdb..00000000 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteEmptyFileInFolderText.st +++ /dev/null @@ -1,8 +0,0 @@ -tests-filestreams -testReadWriteEmptyFileInFolderText - | text | - text := String new. - self - writeToFile: text - withFileNameDo:[ :fileName | - self assert: (text = (GRPlatform current contentsOfFile: fileName binary: false)) ] \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderBinary.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderBinary.st deleted file mode 100644 index ad114bf2..00000000 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderBinary.st +++ /dev/null @@ -1,8 +0,0 @@ -tests-filestreams -testReadWriteToFileInFolderBinary - | bytes | - bytes := #(80 104 39 110 103 108 117 105 32 109 103 108 119 39 110 97 102 104 32 67 116 104 117 108 104 117 32 82 39 108 121 101 104 32 119 103 97 104 39 110 97 103 108 32 102 104 116 97 103 110) asByteArray. - self - writeToFile: bytes - withFileNameDo:[ :fileName | - self assert: (bytes = (GRPlatform current contentsOfFile: fileName binary: true)) ] \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderText.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderText.st deleted file mode 100644 index 2d9fc845..00000000 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testReadWriteToFileInFolderText.st +++ /dev/null @@ -1,8 +0,0 @@ -tests-filestreams -testReadWriteToFileInFolderText - | text | - text := 'Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn'. - self - writeToFile: text - withFileNameDo:[ :fileName | - self assert: (text = (GRPlatform current contentsOfFile: fileName binary: false)) ] \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testWriteToFileInFolder.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testWriteToFileInFolder.st new file mode 100644 index 00000000..04b46b21 --- /dev/null +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testWriteToFileInFolder.st @@ -0,0 +1,27 @@ +tests-files +testWriteToFileInFolder + + | bytes text | + bytes := ByteArray new. + self + writeToFile: bytes + withFileNameDo:[ :fileName | + self assert: (GRPlatform current contentsOfFile: fileName binary: true) equals: bytes ]. + + bytes := #[80 104 39 110 103 108 117 105 32 109 103 108 119 39 110 97 102 104 32 67 116 104 117 108 104 117 32 82 39 108 121 101 104 32 119 103 97 104 39 110 97 103 108 32 102 104 116 97 103 110]. + self + writeToFile: bytes + withFileNameDo:[ :fileName | + self assert:(GRPlatform current contentsOfFile: fileName binary: true) equals: bytes ]. + + text := String new. + self + writeToFile: text + withFileNameDo:[ :fileName | + self assert: (GRPlatform current contentsOfFile: fileName binary: false) equals: text ]. + + text := 'Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn'. + self + writeToFile: text + withFileNameDo:[ :fileName | + self assert: (GRPlatform current contentsOfFile: fileName binary: false) equals: text ] \ No newline at end of file From 2816e8e9e7771bb5e1229cf00f96269f4afab438 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 13:06:30 +0100 Subject: [PATCH 13/16] throw error when creating a duplicate temporary file --- .../instance/newTemporaryFileNamed..st | 5 ++++- .../monticello.meta/categories.st | 2 +- .../instance/testNewTemporaryFileNamed.st | 11 +++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st index 5e778cdd..29d781b7 100644 --- a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,7 @@ files newTemporaryFileNamed: aName - ^ (FileLocator temp / aName) pathString \ No newline at end of file + | newFile | + newFile := FileLocator temp / aName. + newFile exists ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. + ^ newFile pathString \ No newline at end of file diff --git a/repository/Grease-Pharo100-Core.package/monticello.meta/categories.st b/repository/Grease-Pharo100-Core.package/monticello.meta/categories.st index ecc9aa78..47e57aa2 100644 --- a/repository/Grease-Pharo100-Core.package/monticello.meta/categories.st +++ b/repository/Grease-Pharo100-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Grease-Pharo100-Core'! +self packageOrganizer ensurePackage: #'Grease-Pharo100-Core' withTags: #()! diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st index 68d6ff3c..354c5403 100644 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testNewTemporaryFileNamed.st @@ -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) \ No newline at end of file + self deny: (GRPlatform current fileExists: temporaryFile). + \ No newline at end of file From e1a14c913761976247fb0916de591a7fcf45501c Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 13:32:42 +0100 Subject: [PATCH 14/16] error when creating a duplicate temporary file name on GemStone, older Pharo and Squeak --- .../instance/newTemporaryFileNamed..st | 5 ++++- .../GRPharoPlatform.class/instance/newTemporaryFileNamed..st | 5 ++++- .../GRPharoPlatform.class/instance/newTemporaryFileNamed..st | 5 ++++- .../instance/newTemporaryFileNamed..st | 5 ++++- .../instance/newTemporaryFileNamed..st | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st index 46483c70..198e0779 100644 --- a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,7 @@ files newTemporaryFileNamed: aName - ^ (GsFile openWriteOnServer: '/tmp/', aName) pathName + | fileName | + fileName := '/tmp/', aName. + (self fileExists: fileName) ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. + ^ (GsFile openWriteOnServer: fileName) pathName diff --git a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st index 5e778cdd..29d781b7 100644 --- a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,7 @@ files newTemporaryFileNamed: aName - ^ (FileLocator temp / aName) pathString \ No newline at end of file + | newFile | + newFile := FileLocator temp / aName. + newFile exists ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. + ^ newFile pathString \ No newline at end of file diff --git a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st index 5e778cdd..29d781b7 100644 --- a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,7 @@ files newTemporaryFileNamed: aName - ^ (FileLocator temp / aName) pathString \ No newline at end of file + | newFile | + newFile := FileLocator temp / aName. + newFile exists ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. + ^ newFile pathString \ No newline at end of file diff --git a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st index cd8669c0..9e117ca4 100644 --- a/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-Squeak5-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,7 @@ files newTemporaryFileNamed: aName - ^ (FileDirectory default / aName) pathName \ No newline at end of file + | file | + file := FileDirectory default / aName. + file exists ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. + ^ file pathName \ No newline at end of file diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st index cd8669c0..9e117ca4 100644 --- a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/newTemporaryFileNamed..st @@ -1,4 +1,7 @@ files newTemporaryFileNamed: aName - ^ (FileDirectory default / aName) pathName \ No newline at end of file + | file | + file := FileDirectory default / aName. + file exists ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. + ^ file pathName \ No newline at end of file From 14e6afb83aff9232d62b7bbcbb79bde4a97b36b5 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 13:38:32 +0100 Subject: [PATCH 15/16] use GRPlatform current pathSeparator in the filename generation for temporary files on gemstone --- .../GRGemStonePlatform.class/instance/newTemporaryFileNamed..st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st index 198e0779..6f8c5c0a 100644 --- a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/newTemporaryFileNamed..st @@ -2,6 +2,6 @@ files newTemporaryFileNamed: aName | fileName | - fileName := '/tmp/', aName. + fileName := GRPlatform current pathSeparator,'tmp', GRPlatform current pathSeparator, aName. (self fileExists: fileName) ifTrue: [ GRError new signal: 'A (temporary) file with name ', aName, ' already exists.' ]. ^ (GsFile openWriteOnServer: fileName) pathName From 5ae43f87a9d9062a2c92c4b164c5970fb69814be Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Sun, 4 Feb 2024 13:40:55 +0100 Subject: [PATCH 16/16] revert changes for categories in Squeak packages --- .../Grease-Squeak5-Core.package/monticello.meta/categories.st | 2 +- .../Grease-Squeak6-Core.package/monticello.meta/categories.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repository/Grease-Squeak5-Core.package/monticello.meta/categories.st b/repository/Grease-Squeak5-Core.package/monticello.meta/categories.st index 9dee02a6..00eecc3b 100644 --- a/repository/Grease-Squeak5-Core.package/monticello.meta/categories.st +++ b/repository/Grease-Squeak5-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -self packageOrganizer ensurePackage: #'Grease-Squeak5-Core' withTags: #()! +SystemOrganization addCategory: #'Grease-Squeak5-Core'! diff --git a/repository/Grease-Squeak6-Core.package/monticello.meta/categories.st b/repository/Grease-Squeak6-Core.package/monticello.meta/categories.st index c47b0497..89aae6c1 100644 --- a/repository/Grease-Squeak6-Core.package/monticello.meta/categories.st +++ b/repository/Grease-Squeak6-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -self packageOrganizer ensurePackage: #'Grease-Squeak6-Core' withTags: #()! +SystemOrganization addCategory: #'Grease-Squeak6-Core'!