Thanks for the sample code! ... I keep forgetting that a scan of
allInstances is a good way to patch problems like these:) and the fixed
to relative path snippet is especially useful.
Dale
On 8/1/19 1:50 PM, Sean P. DeNigris wrote:
Dale Henrichs-3 wrote
the act of starting the image automagically populates the System >> local
directory with a full path to a directory in my current directory
This sounds like the same problem I've been having with absolute resolved
paths to local iceberg repos. Here is the script I use to fix them in a way
that survives image moving and renaming. It should be easy to adapt for your
needs. Obviously it would be better if Pharo didn't resolve the paths in
these cases, but at least there is a workaround.
fixIcebergRepoLocations
"E.g. after an image is moved or renamed, its local Iceberg repos become
broken because the locations are stored as static FileReferences instead of
dynamic FileLocations following the image around. Limitation: assumes all
images are stored in flat folders under root"
| imageRoot repos |
imageRoot := FileLocator home / 'Dynabook' / 'Working Images'.
repos := IceLibgitRepository allSubInstances
select: [ :e |
e location isNotNil
and: [ (FileLocator imageDirectory contains: e
location) not
and: [ imageRoot contains: e
location ] ] ].
repos
do: [ :e |
| oldPath newPath fixedLocation |
oldPath := e location relativeTo: imageRoot.
newPath := RelativePath withAll: oldPath segments
allButFirst.
fixedLocation := FileLocator imageDirectory withPath:
newPath.
e location: fixedLocation ]
-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html