[chore] device/input: migrate custom event map to settings dir (#3822)

pull/3829/head
Frans de Jonge 6 years ago committed by GitHub
parent 086ced07f9
commit b4002dc9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,10 +2,11 @@
An interface to get input events. An interface to get input events.
]] ]]
local DataStorage = require("datastorage")
local DEBUG = require("dbg") local DEBUG = require("dbg")
local Event = require("ui/event") local Event = require("ui/event")
local Key = require("device/key")
local GestureDetector = require("device/gesturedetector") local GestureDetector = require("device/gesturedetector")
local Key = require("device/key")
local TimeVal = require("ui/timeval") local TimeVal = require("ui/timeval")
local framebuffer = require("ffi/framebuffer") local framebuffer = require("ffi/framebuffer")
local input = require("ffi/input") local input = require("ffi/input")
@ -150,7 +151,9 @@ function Input:init()
self.event_map[10021] = "NotCharging" self.event_map[10021] = "NotCharging"
-- user custom event map -- user custom event map
local ok, custom_event_map = pcall(dofile, "custom.event.map.lua") local custom_event_map_location = string.format(
"%s/%s", DataStorage:getSettingsDir(), "event_map.lua")
local ok, custom_event_map = pcall(dofile, custom_event_map_location)
if ok then if ok then
for key, value in pairs(custom_event_map) do for key, value in pairs(custom_event_map) do
self.event_map[key] = value self.event_map[key] = value

Loading…
Cancel
Save