From 4bde062bd668fe4454cb19d3cb9e3bd86e2fa15e Mon Sep 17 00:00:00 2001 From: "Steven R. Baker" Date: Sun, 8 Oct 2017 14:06:04 +0200 Subject: [PATCH] Add the ability to load icons from a zip archive. --- repository/IconFactory.package/.filetree | 5 +++-- .../class/loadZip.intoClass..st | 3 +++ .../instance/loadZip.intoClass..st | 9 +++++++++ .../IconFactory.class/properties.json | 19 ++++++++----------- .../IconFactoryTest.class/properties.json | 19 +++++++++---------- .../IconFactory.package/properties.json | 3 +-- 6 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 repository/IconFactory.package/IconFactory.class/class/loadZip.intoClass..st create mode 100644 repository/IconFactory.package/IconFactory.class/instance/loadZip.intoClass..st diff --git a/repository/IconFactory.package/.filetree b/repository/IconFactory.package/.filetree index 8998102..57a6797 100644 --- a/repository/IconFactory.package/.filetree +++ b/repository/IconFactory.package/.filetree @@ -1,4 +1,5 @@ { - "noMethodMetaData" : true, "separateMethodMetaAndSource" : false, - "useCypressPropertiesFile" : true } + "noMethodMetaData" : true, + "useCypressPropertiesFile" : true +} \ No newline at end of file diff --git a/repository/IconFactory.package/IconFactory.class/class/loadZip.intoClass..st b/repository/IconFactory.package/IconFactory.class/class/loadZip.intoClass..st new file mode 100644 index 0000000..f9429be --- /dev/null +++ b/repository/IconFactory.package/IconFactory.class/class/loadZip.intoClass..st @@ -0,0 +1,3 @@ +installing +loadZip: aZipFile intoClass: aClassOrName + ^ self new loadZip: aZipFile intoClass: aClassOrName \ No newline at end of file diff --git a/repository/IconFactory.package/IconFactory.class/instance/loadZip.intoClass..st b/repository/IconFactory.package/IconFactory.class/instance/loadZip.intoClass..st new file mode 100644 index 0000000..6175f79 --- /dev/null +++ b/repository/IconFactory.package/IconFactory.class/instance/loadZip.intoClass..st @@ -0,0 +1,9 @@ +loading +loadZip: aZipFile intoClass: aClassOrName + | cls tmpDir | + cls := self ensureClassFor: aClassOrName. + tmpDir := (FileLocator temp asFileReference / UUID new asString) createDirectory. + (ZipArchive new readFrom: aZipFile) members + do: [ :member | member extractInDirectory: tmpDir overwrite: true ]. + self createIconsFromDirectory: tmpDir asFileReference inClass: cls. + tmpDir delete \ No newline at end of file diff --git a/repository/IconFactory.package/IconFactory.class/properties.json b/repository/IconFactory.package/IconFactory.class/properties.json index 80f5f77..a261764 100644 --- a/repository/IconFactory.package/IconFactory.class/properties.json +++ b/repository/IconFactory.package/IconFactory.class/properties.json @@ -1,14 +1,11 @@ { - "category" : "IconFactory", - "classinstvars" : [ - ], - "classvars" : [ - ], "commentStamp" : "PeterUhnak 8/28/2016 21:54", - "instvars" : [ - ], - "name" : "IconFactory", - "pools" : [ - ], "super" : "Object", - "type" : "normal" } + "category" : "IconFactory", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "IconFactory", + "type" : "normal" +} \ No newline at end of file diff --git a/repository/IconFactory.package/IconFactoryTest.class/properties.json b/repository/IconFactory.package/IconFactoryTest.class/properties.json index a81044c..c61f781 100644 --- a/repository/IconFactory.package/IconFactoryTest.class/properties.json +++ b/repository/IconFactory.package/IconFactoryTest.class/properties.json @@ -1,14 +1,13 @@ { - "category" : "IconFactory", - "classinstvars" : [ - ], - "classvars" : [ - ], "commentStamp" : "", + "super" : "TestCase", + "category" : "IconFactory", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], "instvars" : [ - "factory" ], + "factory" + ], "name" : "IconFactoryTest", - "pools" : [ - ], - "super" : "TestCase", - "type" : "normal" } + "type" : "normal" +} \ No newline at end of file diff --git a/repository/IconFactory.package/properties.json b/repository/IconFactory.package/properties.json index f037444..6f31cf5 100644 --- a/repository/IconFactory.package/properties.json +++ b/repository/IconFactory.package/properties.json @@ -1,2 +1 @@ -{ - } +{ } \ No newline at end of file