Add the possibility run shell scripts from filemanager on android (#6288)

This commit is contained in:
zwim
2020-06-25 21:33:51 +02:00
committed by GitHub
parent 9385728769
commit 43693c9fe9
4 changed files with 29 additions and 16 deletions

View File

@@ -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