When I forward `/Users/joksovic/ic_re_center_dark....
# compose-desktop
p
When I forward
/Users/joksovic/ic_re_center_dark.svg
to a
painterResource
I get
Exception in thread "AWT-EventQueue-0 @coroutine#12" java.lang.IllegalArgumentException: Resource /Users/joksovic/ic_re_center_dark.svg not found
what am I doing wrong?
s
So from your crash it looks like you are trying to access
ic_re_center_dark.svg
in a place where it doesn’t exist. I imagine that it’s not inside of
/Users/joksovic/ic_re_center_dark.svg
right? It should be in your compose resources folder or inside gradle resources folder.
p
You're right, this is how to do it:
Copy code
painter = loadSvgPainter(inputStream = File(pathToFile).inputStream(), density = LocalDensity.current),
s
what is
pathToFile
?
p
in my case it would be
/Users/joksovic/ic_re_center_dark.svg
but whatever you pass
it doesn't have to be placed inside the compose resources folder
m
Resources are normally bundled with the application which will not happen in your case. Is that really your intention to load some external image that way which will only exist on your computer?
👆 1
p
yes, it's a desktop app in which users can select a file from their machine