-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
305 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"separateMethodMetaAndSource" : false, | ||
"noMethodMetaData" : true, | ||
"useCypressPropertiesFile" : true | ||
} |
7 changes: 7 additions & 0 deletions
7
source/Magritte-Pharo7-Model.package/GRPackage.extension/class/magrittePharoModel.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*Magritte-Pharo7-Model | ||
magrittePharoModel | ||
^ self new | ||
name: 'Magritte-Pharo-Model'; | ||
addDependency: 'Magritte-Model'; | ||
url: #magritteUrl; | ||
yourself |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/GRPackage.extension/properties.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "GRPackage" | ||
} |
5 changes: 5 additions & 0 deletions
5
...-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteAllSubInstancesOf.do..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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*Magritte-Pharo7-Model | ||
magritteAllSubInstancesOf: aClass do: aBlock | ||
"Evaluate the aBlock for all instances of aClass and all its subclasses." | ||
|
||
aClass allSubInstancesDo: aBlock |
5 changes: 5 additions & 0 deletions
5
...e/Magritte-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteClassNamed..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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*Magritte-Pharo7-Model | ||
magritteClassNamed: aString | ||
"Return the class named aString, nil if the class can't be found." | ||
|
||
^ Smalltalk classNamed: aString |
5 changes: 5 additions & 0 deletions
5
...ce/Magritte-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteColorClass.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*Magritte-Pharo7-Model | ||
magritteColorClass | ||
"Return a Color class" | ||
|
||
^ Color |
6 changes: 6 additions & 0 deletions
6
...tte-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteEvaluatorClassFor..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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*Magritte-Pharo7-Model | ||
magritteEvaluatorClassFor: aClass | ||
"Answer an evaluator class appropriate for evaluating expressions in the | ||
context of this class." | ||
|
||
^ aClass compilerClass |
7 changes: 7 additions & 0 deletions
7
...agritte-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteTimeStampClass.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*Magritte-Pharo7-Model | ||
magritteTimeStampClass | ||
"Return the platform's TimeStamp class. It is currently assumed that all platforms | ||
have one, though this may not be correct and could require moving timestamp stuff | ||
to its own package in order to resolve." | ||
|
||
^ DateAndTime |
6 changes: 6 additions & 0 deletions
6
...tte-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteTimeStampIfAbsent..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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*Magritte-Pharo7-Model | ||
magritteTimeStampIfAbsent: absentBlock | ||
"Return the TimeStamp class, or if the platform does not have a TimeStamp | ||
return the result of evaluating absentBlock." | ||
|
||
^ DateAndTime |
6 changes: 6 additions & 0 deletions
6
.../Magritte-Pharo7-Model.package/GRPharoPlatform.extension/instance/magritteUniqueObject.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*Magritte-Pharo7-Model | ||
magritteUniqueObject | ||
"Answer a random object, such as a UUID, that is extremely likely to | ||
be unique over space and time." | ||
|
||
^ ByteArray withAll: UUID new |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/GRPharoPlatform.extension/properties.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "GRPharoPlatform" | ||
} |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/README.md
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
I manage the file-data I represent on the file-system. From the programmer this looks the same as if the file would be in memory (==*MAMemoryFileModel*==), as it is transparently loaded and written out as necessary. | ||
|
||
I delegate my actual location on disk to MAFileDatabase (see class comment). |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/class/baseDirectoryPath..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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
baseDirectoryPath: aString | ||
" deprecated, but still used by pier " | ||
MAFileDatabase baseDirectory: aString |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/class/baseDirectoryPath.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
baseDirectoryPath | ||
" deprecated: use MAFileDatabase baseDirectoryPath instead " | ||
^MAFileDatabase baseDirectory fullName |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/class/baseUrl..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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
baseUrl: aString | ||
" deprecated: use MAFileDatabase baseUrl instead " | ||
^ MAFileDatabase baseUrl: aString |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/class/baseUrl.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
baseUrl | ||
" deprecated: use MAFileDatabase baseDirectoryPath instead " | ||
^ MAFileDatabase baseUrl |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/^equals.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
comparing | ||
= anObject | ||
^ super = anObject and: [ self directory = anObject directory ] |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/baseUrl.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
configuration | ||
baseUrl | ||
^ self database baseUrl |
7 changes: 7 additions & 0 deletions
7
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/contents..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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
accessing | ||
contents: aByteArray | ||
| stream | | ||
stream := self writeStream. | ||
[ stream nextPutAll: aByteArray asByteArray ] | ||
ensure: [ stream close ]. | ||
super contents: aByteArray |
9 changes: 9 additions & 0 deletions
9
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/contents.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
accessing | ||
contents | ||
| stream | | ||
^ self file exists | ||
ifFalse: [ ByteArray new ] | ||
ifTrue: [ | ||
stream := self readStream. | ||
[ stream contents ] | ||
ensure: [ stream close ] ] |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/database.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
private | ||
database | ||
|
||
^ MAFileDatabase new. |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/directory.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing-dynamic | ||
directory | ||
|
||
^ directory ifNil: [ directory := self database uniqueLocation ]. |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/file.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing-dynamic | ||
file | ||
^(self directory / self filename) asFileReference |
10 changes: 10 additions & 0 deletions
10
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/finalize.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
initialization | ||
finalize | ||
| dir | | ||
dir := self directory. | ||
dir exists | ||
ifTrue: [ dir deleteAll ]. | ||
[ (dir := dir parent) hasChildren ] | ||
whileFalse: [ dir ensureDelete ]. | ||
super finalize. | ||
location := nil |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/hash.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
comparing | ||
hash | ||
^ super hash bitXor: self directory hash |
7 changes: 7 additions & 0 deletions
7
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/postCopy.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
copying | ||
postCopy | ||
| previous | | ||
super postCopy. | ||
previous := self contents. | ||
location := nil. | ||
self contents: previous |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/readStream.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing-dynamic | ||
readStream | ||
^ self file binaryReadStream |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/instance/writeStream.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing-dynamic | ||
writeStream | ||
^ self file binaryWriteStream |
14 changes: 14 additions & 0 deletions
14
source/Magritte-Pharo7-Model.package/MAExternalFileModel.class/properties.json
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"commentStamp" : "<historical>", | ||
"super" : "MAFileModel", | ||
"category" : "Magritte-Pharo7-Model", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"location", | ||
"directory" | ||
], | ||
"name" : "MAExternalFileModel", | ||
"type" : "normal" | ||
} |
14 changes: 14 additions & 0 deletions
14
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/README.md
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
I provide locations for external files. | ||
|
||
- The ==#baseDirectory== is the place where Magritte puts its file-database. Keep this value to nil to make it default to a subdirectory next to the Smalltalk image. | ||
- The ==#baseUrl== is a nice optimization to allow Apache (or any other Web Server) to directly serve the files. ==#baseUrl== is an absolute URL-prefix that is used to generate the path to the file. If you have specified one the file data does not go trough the image anymore, but instead is directly served trough the properly configured Web Server. | ||
|
||
The files are currently stored using the following scheme: | ||
|
||
=/files/9d/bsy8kyp45g0q7blphknk48zujap2wd/earthmap1k.jpg | ||
=1 2 3 4 | ||
|
||
1. is the #baseDirectory as specified in the settings. | ||
2. Are 256 directories named '00' to 'ff' to avoid having thousands of files in the same directory. Unfortunately this leads to problems with the Squeak file primitives and some filesystems don't handle that well. This part is generated at random. | ||
3. This is a secure ID, similar to the Seaside session key. It is generated at random and provides a security system that even works through Apache (you have to disable directory listings of course): if you don't know the filename you can not access the file. | ||
4. This is the original filename. Subclasses might want to store other cached versions of the same file there, for example resized images, etc. |
5 changes: 5 additions & 0 deletions
5
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/class/baseDirectory..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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
baseDirectory: aStringOrDirectory | ||
"Defines where the files are stored. If this value is set to nil, it defaults to a subdirectory of of the current image-location." | ||
|
||
baseDirectory := aStringOrDirectory asFileReference. |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/class/baseDirectory.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
baseDirectory | ||
^ baseDirectory ifNil: [ FileLocator imageDirectory / 'files' ]. |
8 changes: 8 additions & 0 deletions
8
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/class/baseUrl..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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
accessing | ||
baseUrl: aString | ||
"Defines the base-URL where the files are served from, when using an external web server. This setting is left to nil by default, causing the files to be served trough the image." | ||
|
||
baseUrl := aString isNil ifFalse: [ | ||
aString last = $/ | ||
ifFalse: [ aString ] | ||
ifTrue: [ aString copyUpToLast: $/ ] ] |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/class/baseUrl.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
baseUrl | ||
^ baseUrl |
14 changes: 14 additions & 0 deletions
14
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/class/garbageCollect.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
public | ||
garbageCollect | ||
"Remove obsolete files from the file-system that are not referenced from the image anymore. This method has to be called manually and is not intended to be portable." | ||
|
||
| mark sweep | | ||
mark := self allInstances | ||
collect: [ :each | each directory ]. | ||
sweep := Array with: self baseDirectory. | ||
self locationDefinition do: [ :definition | | ||
sweep := sweep gather: [ :directory | | ||
directory hasChildren ifFalse: [ directory delete ]. | ||
FileLocator imageDirectory directories select: [ :e | e basename size = definition first ] ] ]. | ||
sweep do: [ :directory | | ||
(mark includes: directory) ifFalse: [ directory recursiveDelete ] ] |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/class/locationDefinition.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public | ||
locationDefinition | ||
^ #( ( 2 '63450af8d9c2e17b' ) ( 30 'iaojv41bw67e0tud5m9rgplqfy8x3cs2kznh' ) ) |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/instance/baseDirectory.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
baseDirectory | ||
|
||
^ self class baseDirectory. |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/instance/baseUrl.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
baseUrl | ||
|
||
^ self class baseUrl. |
9 changes: 9 additions & 0 deletions
9
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/instance/randomIdentifierName.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
private | ||
randomIdentifierName | ||
|
||
| digits idLength allowedCharacters | | ||
digits := $0 to: $9. | ||
allowedCharacters := digits, Character alphabet. | ||
idLength := 30. | ||
^ String streamContents: [ :str | | ||
idLength timesRepeat: [ str nextPut: allowedCharacters atRandom ] ]. |
7 changes: 7 additions & 0 deletions
7
.../Magritte-Pharo7-Model.package/MAFileDatabase.class/instance/randomPartitionFolderName.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
private | ||
randomPartitionFolderName | ||
"Returns a string between '00' to 'FF'" | ||
|
||
| twoCharacterHexString | | ||
twoCharacterHexString := 16rFF atRandom printStringBase: 16 length: 2 padded: true. | ||
^ twoCharacterHexString asLowercase. |
12 changes: 12 additions & 0 deletions
12
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/instance/uniqueLocation.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
public | ||
uniqueLocation | ||
"Finds an unique path to be used and create the necessary sub directories." | ||
|
||
| partition id result | | ||
[ | ||
partition := self randomPartitionFolderName. | ||
id := self randomIdentifierName. | ||
result := self baseDirectory ensureCreateDirectory / partition / id. | ||
] doWhileTrue: [ result exists ]. | ||
|
||
^ result ensureCreateDirectory. |
14 changes: 14 additions & 0 deletions
14
source/Magritte-Pharo7-Model.package/MAFileDatabase.class/properties.json
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"commentStamp" : "<historical>", | ||
"super" : "Object", | ||
"category" : "Magritte-Pharo7-Model", | ||
"classinstvars" : [ | ||
"baseDirectory", | ||
"baseUrl" | ||
], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "MAFileDatabase", | ||
"type" : "normal" | ||
} |
Empty file.
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAFileSystem.class/class/extensionFor..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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
paths | ||
extensionFor: aString | ||
|
||
^ aString asFileReference extension. |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MAFileSystem.class/class/fileSizeFor..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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
entries | ||
fileSizeFor: filenameString | ||
^ filenameString asFileReference size |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAFileSystem.class/class/fullNameFor..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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
paths | ||
fullNameFor: aString | ||
|
||
^ aString asFileReference fullName. |
4 changes: 4 additions & 0 deletions
4
source/Magritte-Pharo7-Model.package/MAFileSystem.class/class/imageDirectory.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
locations | ||
imageDirectory | ||
|
||
^ FileLocator imageDirectory. |
6 changes: 6 additions & 0 deletions
6
source/Magritte-Pharo7-Model.package/MAFileSystem.class/class/mimeTypesForExtension..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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mime types | ||
mimeTypesForExtension: aString | ||
|
||
| types | | ||
types := MIMEType forExtensionReturnMimeTypesOrNil: aString. | ||
^ types ifNotNil: [ types collect: [ :e | e asString ] ]. |
11 changes: 11 additions & 0 deletions
11
source/Magritte-Pharo7-Model.package/MAFileSystem.class/properties.json
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "Object", | ||
"category" : "Magritte-Pharo7-Model", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "MAFileSystem", | ||
"type" : "normal" | ||
} |
10 changes: 10 additions & 0 deletions
10
source/Magritte-Pharo7-Model.package/MorphicUIManager.extension/instance/chooseFile.in..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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*Magritte-Pharo7-Model | ||
chooseFile: windowTitle in: directoryString | ||
|
||
| chooser | | ||
chooser := FileDialogWindow newWithTheme: UITheme current. | ||
chooser | ||
title: windowTitle; | ||
selectDirectory: directoryString; | ||
answerFileEntry. | ||
^ chooser openModal answer ifNotNil: [ :answer | answer asFileReference ]. |
3 changes: 3 additions & 0 deletions
3
source/Magritte-Pharo7-Model.package/MorphicUIManager.extension/properties.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "MorphicUIManager" | ||
} |
1 change: 1 addition & 0 deletions
1
source/Magritte-Pharo7-Model.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
SystemOrganization addCategory: #'Magritte-Pharo7-Model'! |
Empty file.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
(name 'Magritte-Pharo7-Model') |
Oops, something went wrong.