https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
m

Marcin Wisniowski

03/06/2024, 1:03 AM
The new resource system in 1.6.0 is nice but it feels like a downgrade in that it doesn't seem to support nested directories. I had my graphics organized nicely into a directory tree, but to migrate to the new resources I have to dump them all together into
composeResources/drawable
with no subdirectories allowed.
r

romainguy

03/06/2024, 1:21 AM
I assume it's because it makes it compatible with Android resources
m

Marcin Wisniowski

03/06/2024, 1:49 AM
Probably, but when I'm making a Desktop-only project without Android (or anything else multiplatform), it doesn't feel like limitations of Android should apply. So that's my feedback.
plus one 3
It does allow resources with
-
in the name, even though Android doesn't. 🤔
m

mohamed rejeb

03/06/2024, 8:59 AM
I think this can be possible and compatible with android, maybe during compile time the resources can be moved to the drawable folder. And the names can be something like this: /drawable/icon/cancel.xml -> Res.drawable.icon_cancel
@Konstantin Tskhovrebov 👀
a

Altynbek Nurtaza

03/06/2024, 9:19 AM
would it then be a problem to have both /drawable/icon/cancel.xml and /drawable/icon_cancel.xml? @mohamed rejeb
👍🏻 1
m

mohamed rejeb

03/06/2024, 9:24 AM
Yes the build can fail in this case with a message saying that there's two resources with the same name or something like that.
k

Konstantin Tskhovrebov

03/06/2024, 9:24 AM
nested directories are supported in the files directory but there are no static accessors. so, you need to choose. the nesting makes static accessors generation much harder.
m

Marcin Wisniowski

03/06/2024, 6:56 PM
Sure, using
Res.readBytes()
works, but using that for every resource is not a real choice. The real choice is to no longer organize your resources, or keep using the old resource system which supports nested directories. I think the static accessors are worth it, but it's still a loss.
plus one 1