mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add the possibility run shell scripts from filemanager on android (#6288)
This commit is contained in:
@@ -5,6 +5,7 @@ This module defines stubs for common methods.
|
||||
--]]
|
||||
|
||||
local logger = require("logger")
|
||||
local util = require("util")
|
||||
local _ = require("gettext")
|
||||
|
||||
local function yes() return true end
|
||||
@@ -394,4 +395,15 @@ function Device:ambientBrightnessLevel()
|
||||
return 0
|
||||
end
|
||||
|
||||
--- Returns true if the file is a script we allow running
|
||||
--- Basically a helper method to check a specific list of file extensions for executable scripts
|
||||
---- @string filename
|
||||
---- @treturn boolean
|
||||
function Device:canExecuteScript(file)
|
||||
local file_ext = string.lower(util.getFileNameSuffix(file))
|
||||
if file_ext == "sh" or file_ext == "py" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return Device
|
||||
|
||||
Reference in New Issue
Block a user