when you develop an android/desktop compose multip...
# multiplatform
p
when you develop an android/desktop compose multiplatform app, we have two strings.xml files, one in commonMain/composeResources/values and other in androidMain/res/values. Why? can't we use commonMain strings.xml file for all platforms? for example, I see that manifest requires app_name. Can't get it from commonMain? is a requisite to have duplicated app_name in two strings.xml files?
👌 1
b
I just symlink the two
Then same source of truth is accessible to both systems
p
can you show me the process? I suposse you store all the strings in commonMain, but then, how you acces commonMain app_name from androidMain manifest for the app name?
b
It's just unix symlinks Assuming you have src/commonMain/composeResources/values/strings.xml
Copy code
cd src
ln -s commonMain/composeResources/values/strings.xml path/to/res/values/strings.xml
This way you still end up with 2 files, but editing either will update the other
Make sure to use relative paths as absolute paths will break when you clone gh repo on another machine
m
How would you handle that if someone tries to check out your project on Windows?
p
in fact I'm using windows, that doesn't seem to be a good solution
m
I am developing on a Mac but as we are talking about desktop apps I also have to build them for Windows. I do that on a GitHub runner and on this runner the project would have to be ckecked out on the windows platform, which doesn’t work because Windows doesn’t support symbolic links.
p
so I suppose it's mandatory to have duplicated strings.xml files with duplicated properties like app_name ?
m
I’d say yes.
p
thanks
b
Windows now supports symlinks too and git is equipped to handle that
Or if you're just using git bash on windows it should work just fine out if the box. I have projects with symlinks building on windows ci without issues
This explains the situation quite well https://gitforwindows.org/symbolic-links.html
👀 1