Now reuse past .zip
Now ask for a project name
MODIFY
src/Image-Launcher.package/ImageLauncherModel.class/instance/download..st
src/Image-Launcher.package/ImageLauncherModel.class/instance/download..st
downloading
-download: anURL
+download: anElement
+ | fileToDownload |
+ fileToDownload := (StartupLoader preferencesGeneralFolder asFileReference / SystemVersion current dottedMajorMinor / anElement name, 'zip').
+ (fileToDownload exists)
+ ifTrue: [ ^ self ]
+ ifFalse: [ ZnClient new
+ url: anElement url asString ;
+ downloadTo: fileToDownload . ].
\ No newline at end of file
- ZnClient new
- url: anURL ;
- downloadTo: (StartupLoader preferencesGeneralFolder asFileReference / SystemVersion current dottedMajorMinor).
\ No newline at end of file

MODIFY
src/Image-Launcher.package/ImageLauncherModel.class/instance/fetchOnlineImage..st
src/Image-Launcher.package/ImageLauncherModel.class/instance/fetchOnlineImage..st
@@ -5,7 +5,7 @@ fetchOnlineImage: anURL
list := OrderedCollection new.
xmlDoc allElementsNamed: #template do: [:each |
list add: (ImageLauncherElement
- name: (each nodes elementAt: #name) nodes first
- url: (each nodes elementAt: #url) nodes first
- category: (each nodes elementAt: #category) nodes first)].
+ name: (each nodes elementAt: #name) nodes first asString
+ url: (each nodes elementAt: #url) nodes first asString
+ category: (each nodes elementAt: #category) nodes first asString )].
^ list
\ No newline at end of file

ADD
src/Image-Launcher.package/ImageLauncherModel.class/instance/imageDirectory.st
+unzipping
+imageDirectory
+ ^ (StartupLoader preferencesGeneralFolder asFileReference / SystemVersion current dottedMajorMinor)
\ No newline at end of file

MODIFY
src/Image-Launcher.package/ImageLauncherModel.class/instance/loadAndRun..st
src/Image-Launcher.package/ImageLauncherModel.class/instance/loadAndRun..st
runnnig
loadAndRun: anElement
- self download: anElement url asString.
- self unzip: anElement url asString asZnUrl lastPathSegment .
- self run: anElement name asString, '.image'.
\ No newline at end of file
+ self download: anElement .
+ self unzip: anElement .
+ self run: (self userChoiceName: anElement)
\ No newline at end of file

ADD
src/Image-Launcher.package/ImageLauncherModel.class/instance/move.from.to..st
+runnnig
+move: aStringFile from: aStringOrigninalDirectory to: aStringDirectory
+
+ OSProcess command:
+ ('mv ',
+ aStringOrigninalDirectory ,
+ '/',
+ aStringFile,
+ ' ',
+ aStringDirectory ,
+ '/').
\ No newline at end of file

ADD
src/Image-Launcher.package/ImageLauncherModel.class/instance/move.to..st
+runnnig
+move: aStringFile to: aStringDirectory
+
+ | aString |
+ OSProcess command:
+ ('mv ',
+ aStringDirectory,
+ '/*.image ',
+ aStringDirectory ,
+ '/',
+ aString, '.image').
+ OSProcess command:
+ ('mv ',
+ aStringDirectory,
+ '/*.changes ',
+ aStringDirectory ,
+ '/',
+ aString, '.changes').
\ No newline at end of file

ADD
src/Image-Launcher.package/ImageLauncherModel.class/instance/rename.to..st
+runnnig
+rename: aStringDirectory to: aString
+
+ OSProcess command:
+ ('mv ',
+ aStringDirectory,
+ '/*.image ',
+ aStringDirectory ,
+ '/',
+ aString, '.image').
+ OSProcess command:
+ ('mv ',
+ aStringDirectory,
+ '/*.changes ',
+ aStringDirectory ,
+ '/',
+ aString, '.changes').
\ No newline at end of file

MODIFY
src/Image-Launcher.package/ImageLauncherModel.class/instance/run..st
src/Image-Launcher.package/ImageLauncherModel.class/instance/run..st
runnnig
-run: anElement
+run: aString
+ self halt.
OSProcess command:
(Smalltalk vm fullPath asString,
' ',
- FileSystem disk workingDirectory pathString,
- '\',
- anElement asString).
\ No newline at end of file
+ self imageDirectory pathString,
+ '/',
+ aString,
+ '.image').
\ No newline at end of file

ADD
src/Image-Launcher.package/ImageLauncherModel.class/instance/tmpDirectory..st
+runnnig
+tmpDirectory: anElement
+ ^ (StartupLoader preferencesGeneralFolder asFileReference / SystemVersion current dottedMajorMinor / anElement name asString ) pathString
\ No newline at end of file

MODIFY
src/Image-Launcher.package/ImageLauncherModel.class/instance/unzip..st
src/Image-Launcher.package/ImageLauncherModel.class/instance/unzip..st
unzipping
-unzip: aFileName
+unzip: anElement
ZipArchive new
- readFrom: (StartupLoader preferencesGeneralFolder asFileReference / SystemVersion current dottedMajorMinor / aFileName);
- extractAllTo: (StartupLoader preferencesGeneralFolder asFileReference / SystemVersion current dottedMajorMinor).
\ No newline at end of file
+ readFrom: (self imageDirectory / anElement name asString, 'zip');
+ extractAllTo: (self imageDirectory / anElement name asString ).
+ self rename: (self tmpDirectory: anElement) to: anElement name asString
\ No newline at end of file

ADD
src/Image-Launcher.package/ImageLauncherModel.class/instance/userChoiceName..st
+runnnig
+userChoiceName: anElement
+ | widget |
+ widget := InputWidget new.
+ widget
+ title: 'Choice project name';
+ label: 'Project name?';
+ ghostText: ''.
+
+ World openModal: widget openDialogWithSpec window.
+
+ (widget value contents asString = '')
+ ifTrue: [ self userChoiceName: anElement ]
+ ifFalse: [
+ self rename: (self tmpDirectory: anElement) to: widget value contents asString.
+ self move: (widget value contents asString, '.image') from: (self tmpDirectory: anElement) to: self imageDirectory pathString.
+ self move: (widget value contents asString, '.changes') from: (self tmpDirectory: anElement) to: self imageDirectory pathString.
+ ^ widget value contents asString
+ ]
+
\ No newline at end of file

Now reuse past .zip
Now ask for a project name