jackguo6973
jackguo6973
MModular
Created by jackguo6973 on 10/17/2024 in #questions
alias and os.getenv
Hi I have a question regarding constants and env variable. I was hoping to do something like
import os

alias PATH_LIB_SDL2 = os.getenv("SDL2_PATH" , "/opt/homebrew/Cellar/sdl2/2.30.8/lib/libSDL2.dylib")

alias PATH_LIB_SDL2_TTF = os.getenv("SDL2_TTF_PATH" , "/opt/homebrew/Cellar/sdl2_ttf/2.22.0/lib/libSDL2_ttf-2.0.0.dylib")
import os

alias PATH_LIB_SDL2 = os.getenv("SDL2_PATH" , "/opt/homebrew/Cellar/sdl2/2.30.8/lib/libSDL2.dylib")

alias PATH_LIB_SDL2_TTF = os.getenv("SDL2_TTF_PATH" , "/opt/homebrew/Cellar/sdl2_ttf/2.22.0/lib/libSDL2_ttf-2.0.0.dylib")
where I can inject the path to a library depending on the os/system configuration and mojo would declare it as a constant at runtime. Is this not possible and I have to switch and make those library paths a variable or is there a way to declare them as constants without hardcoding the library paths?
1 replies