function detectOSAndGetKeyBindingsPath()
local os_name = os.platform()
local renoise_version = renoise.RENOISE_VERSION
local key_bindings_path
if os_name == "WINDOWS" then
local home = os.getenv("USERPROFILE") or os.getenv("HOME")
key_bindings_path = home .. "\\AppData\\Roaming\\Renoise\\V" .. renoise_version .. "\\KeyBindings.xml"
elseif os_name == "MACINTOSH" then
local home = os.getenv("HOME")
key_bindings_path = home .. "/Library/Preferences/Renoise/V" .. renoise_version .. "/KeyBindings.xml"
else -- Assume Linux
local home = os.getenv("HOME")
key_bindings_path = home .. "/.config/Renoise/V" .. renoise_version .. "/KeyBindings.xml"
end
return key_bindings_path
end
verified as working on macOS, Linux and Windows.
Thanks y’all!
EDIT: I realize %AppData% could’ve been used, but i’ll burn that bridge when i cross it.
It is a good idea to use $HOME/.config if the value of $XDG_CONFIG_HOME does not exist.
If it does not exist there either, you should also look for $HOME/.renoise.
hmm. now i wish i had linux/different flavors that i could try this stuff out
. i think i’m gonna have to rely on bugreports to make it work better. although maybe there’s a proper way to do this. maybe someone has already solved this elsewhere, on stackexchange or something.