This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Pages: 1 - Last Post: 8 Sep 26, 16:39 Last Post By: davidekholm Threads: [ Previous | Next ]
JeffTucker

Posts: 8,688
Registered: 31-Jan-2006
Unexpected change in the getChildren() method
Posted: 5 Sep 26, 22:05
 
  Click to reply to this thread Reply
Consider a project with 4 folders, called F1 through F4. Skin code, in predir.groovy:
allFolders = currentFolder.getParent().getChildren(ao -> ao.isFolder() && !ao.isHidden() && ao.isIncluded());
Before jAlbum 38, this produced:
[F1, F2, F3, F4]
Starting with 38.0.20, it produces:
[/F1, /F2, /F3, /F4]
Sometimes, this is a difference that doesn't matter, but at other times, it ends up producing paths with extraneous slashes. That, in turn, yields some undesirable navigation problems.
JeffTucker

Posts: 8,688
Registered: 31-Jan-2006
Re: Unexpected change in the getChildren() method
Posted: 5 Sep 26, 22:12   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
RobM believes that this may be related to the introduction of views, so untangling this may require considerable caution.
JeffTucker

Posts: 8,688
Registered: 31-Jan-2006
Re: Unexpected change in the getChildren() method
Posted: 6 Sep 26, 00:40   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
So far, I've found only one situation in my skins in which this causes a problem, and it's just a two-line fix in each of three skins. So, something that I can easily work around.

But to me, F1 is an object, but /F1 is a path. ;)
davidekholm

Posts: 4,099
Registered: 18-Oct-2002
Re: Unexpected change in the getChildren() method
Posted: 8 Sep 26, 09:47   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I don't plan to change this actually. Your code sample implicitly triggers the toString() call on each object and objects now print themselves with a leading slash and with the leading path as well. I made this change to ease debugging. It's less ambiguous than just printing the name. if you just want the name (like before v38) call .getName(). If you want the object's full path but without a leading slash, call getPathFromRoot()

Generally speaking, never rely on the format of the toString() call. It's supposed to give the best human readable representation of an object.
JeffTucker

Posts: 8,688
Registered: 31-Jan-2006
Re: Unexpected change in the getChildren() method
Posted: 8 Sep 26, 16:12   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
I do so love surprises. ;)
davidekholm

Posts: 4,099
Registered: 18-Oct-2002
Re: Unexpected change in the getChildren() method
Posted: 8 Sep 26, 16:39   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
I do so love surprises. ;)

Sorry ;-)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums