Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9c3502

Browse files
committed
get_full_path use is_exists()
Signed-off-by: Shewer Lu <[email protected]>
1 parent 2e46bc4 commit c9c3502

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/tools/_file.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
-- Distributed under terms of the MIT license.
77
--
88
-- global function of fileutils
9-
-- bool file_exists( full_path )
9+
-- bool file_exists( full_path )
1010
-- bool isDir(full_path)
1111
-- bool isFile(full_path)
12-
--
12+
--
1313
-- full_path, dir, file get_full_path(filename) -- return "<user_dir>/>path" or "<shared_dir/>path"
1414

1515
-- global function isFile isDir
@@ -37,16 +37,16 @@ end
3737
local udir=rime_api and rime_api.get_user_data_dir() or "."
3838
local sdir=rime_api and rime_api.get_shared_data_dir() or "."
3939
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
4242
fpath = sdir .. "/" .. filename
43-
if isFile(fpath) then return fpath,sdir,filename end
43+
if file_exists(fpath) then return fpath,sdir,filename end
4444
end
4545

4646
function rpath(n)
4747
n= n or 2
4848
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)$")
5050
path = path and path:match("/lua/(.+)$")
5151
return path,file
5252
end

0 commit comments

Comments
 (0)