https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
g

GarouDan

06/14/2020, 8:49 PM
Hi, Do you know if we have something like
System.getenv()
jvm method but that works for
js
and
native
as well?
m

mbonnin

06/14/2020, 8:58 PM
On native, you should be able to use https://man7.org/linux/man-pages/man3/getenv.3.html
g

GarouDan

06/14/2020, 8:59 PM
Oh, thanks, than I can create an expect/actual, I just need the js then.
m

mbonnin

06/14/2020, 8:59 PM
In node, it looks like you have a
process.env
That will only work if you're running in nodeJS. I don't think the browser has access to the host environment variables
g

GarouDan

06/14/2020, 9:01 PM
@mbonnin, do you think this
getenv
function will only work with Linux or would it work with other native targets too?
m

mbonnin

06/14/2020, 9:01 PM
It's part of stdlib, it should be fairly portable
g

GarouDan

06/14/2020, 9:01 PM
Oh, cool, thanks for letting me know
m

mbonnin

06/14/2020, 9:02 PM
Linux/MacOS should work , I'm slightly less confident about windows but I don't see why it wouldn't work there as well
g

GarouDan

06/14/2020, 9:05 PM
Cool, I’ll try to write a simple code to test 😉 Thanks