Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 413

Bugs & Feature Suggestions • [BUG] @Include recursion tree is flawed

$
0
0
This one is gonna be a bit hard to wrap your head around but the example should show the "bug"
We have a folder with the files

MainSkin.ini
└A.inc
└B.inc
└C.inc

In the skin, the meters are color coded to represent it easier, A is RED, C is GREEN, B is BLUE

MainSkin.ini

Code:

[Rainmeter]@IncludeA=A.inc@IncludeB=B.inc
A.inc

Code:

[MeterA]Meter=ImageX=0RY=0RW=50H=50SolidColor=FF0000@IncludeC=C.inc[MeterA2]Meter=ImageX=0RY=0RW=50H=50SolidColor=FF0000
B.inc

Code:

[MeterB]Meter=ImageX=0RY=0RW=50H=50SolidColor=0000FF
C.inc

Code:

[MeterC1]Meter=ImageX=0RY=0RW=50H=50SolidColor=00FF00[MeterC2]Meter=ImageX=0RY=0RW=50H=50SolidColor=00FF00[MeterC3]Meter=ImageX=0RY=0RW=50H=50SolidColor=00FF00
On the assumption that the Docs saying You may also include files within files. Once again, the ordering is determined by placement: when any file includes another file, the new contents are added within its own sections, immediately after the section where the statement is made. is correct, with the way we have written this, let's go over how the @Includes should work, @Include by @Include.

First let's start with the code as is

Code:

[Rainmeter]@IncludeA=A.inc@IncludeB=B.inc
First the @IncludeA is loaded, so the skin now becomes

Code:

[Rainmeter][MeterA]@IncludeC=C.inc[MeterA2]@IncludeB=B.inc
After that, it sees that @IncludeC exists, so it gets placed between the meters

Code:

[Rainmeter][MeterA][MeterC1][MeterC2][MeterC3][MeterA2]@IncludeB=B.inc
Finally, it sees @IncludeB, so it adds it at the end

Code:

[Rainmeter][MeterA][MeterC1][MeterC2][MeterC3][MeterA2][MeterB]
So now let's put them as boxes next to each other with how it should look
ACCCAB
The Rainmeter log debugs the loads for those files in that order too, ACB

And that's how it should work by the logic imposed by the wording on the docs and what humans would assume with recursive actions of this kind... except it dosen't, that's why I made this report, when Rainmeter gets to

Code:

[Rainmeter][MeterA]@IncludeC=C.inc@IncludeB=B.inc; [MeterA2] is in limbo 
for some reason, Rainmeter breaks human logic at this step, it sees that there's an @IncludeC, so [MeterA2] is put into limbo and from the "we have read in A.inc these following sections" list, the @IncludeC triggers "in A.inc we have these sections we have no idea about, assume they are new sections to be placed after every @Include is done" for every single other thing in A.inc, Rainmeter is no longer gonna take it's time dealing with [MeterA2] at this step

This ends up being what Rainmeter currently dose right now

Code:

[Rainmeter][MeterA][MeterC1][MeterC2][MeterC3][MeterB][MeterA2]
which is ACCCBA

I wanted to give a suggestion here but I genuinely have no idea how to fix this. When I found this out my very first reaction was a loud WHYYYYYY???? and laughing at my screen.
Most likely binary tree where the sections are resolved first and the @Includes get their branches later can be a solution for this? (If my assumption that Rainmeter reads @Includes line by line is correct and dosen't read sections before @Includes) I know the solution is to just include [MeterB] in MainSkin.ini, but the logic for the implementation is still flawed and it's what I wanted to point out, the docs are too correct in saying When Rainmeter reaches an @include line, it reads the given file, placing all unique options into any existing sections, then places the remainder of the included file after the section in which it was called.

And to give credits, this was submitted by Gabe on Discord

Statistics: Posted by Jeff — 3 minutes ago — Replies 0 — Views 2



Viewing all articles
Browse latest Browse all 413

Trending Articles