The new resource system in 1.6.0 is nice but it fe...
# compose-desktop
m
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
I assume it's because it makes it compatible with Android resources
m
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
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
would it then be a problem to have both /drawable/icon/cancel.xml and /drawable/icon_cancel.xml? @mohamed rejeb
👍🏻 1
m
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
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
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