|
6 | 6 | -- Distributed under terms of the MIT license. |
7 | 7 | -- |
8 | 8 | -- global function of fileutils |
9 | | --- bool file_exists( full_path ) |
| 9 | +-- bool file_exists( full_path ) |
10 | 10 | -- bool isDir(full_path) |
11 | 11 | -- bool isFile(full_path) |
12 | | --- |
| 12 | +-- |
13 | 13 | -- full_path, dir, file get_full_path(filename) -- return "<user_dir>/>path" or "<shared_dir/>path" |
14 | 14 |
|
15 | 15 | -- global function isFile isDir |
|
37 | 37 | local udir=rime_api and rime_api.get_user_data_dir() or "." |
38 | 38 | local sdir=rime_api and rime_api.get_shared_data_dir() or "." |
39 | 39 | function get_full_path(filename) |
40 | | - local fpath = udir .. "/" .. filename |
41 | | - if isFile(fpath) then return fpath,udir,filename end |
| 40 | + local fpath = udir .. "/" .. filename |
| 41 | + if file_exists(fpath) then return fpath,udir,filename end |
42 | 42 | fpath = sdir .. "/" .. filename |
43 | | - if isFile(fpath) then return fpath,sdir,filename end |
| 43 | + if file_exists(fpath) then return fpath,sdir,filename end |
44 | 44 | end |
45 | 45 |
|
46 | 46 | function rpath(n) |
47 | 47 | n= n or 2 |
48 | 48 | local source_file = debug.getinfo(n,'S').short_src |
49 | | - local path ,file= source_file:match("^(.+)/(.*.lua)$") |
| 49 | + local path ,file= source_file:match("^(.+)/(.*.lua)$") |
50 | 50 | path = path and path:match("/lua/(.+)$") |
51 | 51 | return path,file |
52 | 52 | end |
0 commit comments