def get_exec_from_icon(file_name):
''' Read the Exec line from a Linux icon file '''
sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
CommonUtil.ExecLog(sModuleInfo,"Function Start", 0)
try:
# Open file and read into memory
with open(file_name, "r") as myfile:
data = myfile.readlines()
# Examine each line, looking for the Exec line
for element in data:
if element[:5] == "Exec=":
result = element[5:].strip() # Save execution line without the Exec= part
if result == '':
return 'failed'
return result
except Exception:
errMsg = "Can't get the exec of the file"
return CommonUtil.Exception_Handler(sys.exc_info(),None,errMsg)
BuiltInFunctions.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录