-
Notifications
You must be signed in to change notification settings - Fork 1
/
usefulFunctions.lua
38 lines (31 loc) · 1.37 KB
/
usefulFunctions.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- Requires ------------------------------------------------------------------
require 'sys'
-- Functions -----------------------------------------------------------------
-- eex.ls - unix listing command
function eex.ls(path) return sys.split(sys.ls(path),'\n') end
-- eex.datasetPath - getting the environmental $EEX_DATASETS variable
function eex.datasetsPath()
local ds
ds = os.getenv("EEX_DATASETS")
if not ds then
io.write [[
******************************************************************************
WARNING - $EEX_DATASETS environment variable is not defined
******************************************************************************
Please define an environment $EEX_DATASETS variable
$ export EEX_DATASETS=datasetsDirectoryOnCurrentMachine/
and add it to your <.bashrc> configuration file in order to do not
visualise this WARNING message again.
As long as <datasetsDirectoryOnCurrentMachine> in not included by
quotations (i.e. it is not a string), you can use shortcuts such as
<~/>, <$HOME/>, <$PATH/>, etc..
******************************************************************************
Please, type the dataset directory path for the current machine:
]]
ds = io.read()
-- add `/` at the end of the path if it's missing
if string.sub(ds,-1) ~= '/' then ds = ds .. '/' end
io.write '\n'
end
return ds
end