summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-18 22:48:54 +0800
committerruki <[email protected]>2020-03-18 10:53:29 +0800
commitdd941c7ecac8c9d500660ed7ffc1af36b2ba54b6 (patch)
tree781c9c96e654b1d76a6fc1cedffb6bcb191093d2
parent5c3a3168f645495cc5d2ab3472d1e3d366bbb004 (diff)
rename string.find_last to lastof
-rw-r--r--xmake/actions/require/impl/package.lua2
-rw-r--r--xmake/core/base/log.lua2
-rw-r--r--xmake/core/base/path.lua8
-rw-r--r--xmake/core/base/string.lua2
-rw-r--r--xmake/core/sandbox/modules/import/core/sandbox/module.lua4
-rw-r--r--xmake/modules/utils/archive/extract.lua4
6 files changed, 11 insertions, 11 deletions
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua
index 9a96e34d6..b08f90f4d 100644
--- a/xmake/actions/require/impl/package.lua
+++ b/xmake/actions/require/impl/package.lua
@@ -91,7 +91,7 @@ function _parse_require(require_str, requires_extra, parentinfo)
else
-- get repository name, package name and package url
- local pos = packageinfo:find_last('@', true)
+ local pos = packageinfo:lastof('@', true)
if pos then
-- get package name
diff --git a/xmake/core/base/log.lua b/xmake/core/base/log.lua
index 35f480237..5e766d0b1 100644
--- a/xmake/core/base/log.lua
+++ b/xmake/core/base/log.lua
@@ -35,7 +35,7 @@ function log:file()
if outputfile then
-- get directory
- local i = outputfile:find_last("[/\\]")
+ local i = outputfile:lastof("[/\\]")
if i then
if i > 1 then i = i - 1 end
dir = outputfile:sub(1, i)
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index dd07badf6..b941d1085 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -27,7 +27,7 @@ local string = require("base/string")
-- get the directory of the path
function path.directory(p)
assert(p)
- local i = p:find_last("[/\\]")
+ local i = p:lastof("[/\\]")
if i then
if i > 1 then i = i - 1 end
return p:sub(1, i)
@@ -39,7 +39,7 @@ end
-- get the filename of the path
function path.filename(p)
assert(p)
- local i = p:find_last("[/\\]")
+ local i = p:lastof("[/\\]")
if i then
return p:sub(i + 1)
else
@@ -51,7 +51,7 @@ end
function path.basename(p)
assert(p)
local name = path.filename(p)
- local i = name:find_last(".", true)
+ local i = name:lastof(".", true)
if i then
return name:sub(1, i - 1)
else
@@ -62,7 +62,7 @@ end
-- get the file extension of the path: .xxx
function path.extension(p)
assert(p)
- local i = p:find_last(".", true)
+ local i = p:lastof(".", true)
if i then
return p:sub(i)
else
diff --git a/xmake/core/base/string.lua b/xmake/core/base/string.lua
index e188596ce..4a224b2c5 100644
--- a/xmake/core/base/string.lua
+++ b/xmake/core/base/string.lua
@@ -31,7 +31,7 @@ string._trim = string._trim or string.trim
string._split = string._split or string.split
-- find the last substring with the given pattern
-function string:find_last(pattern, plain)
+function string:lastof(pattern, plain)
-- find the last substring
local curr = 0
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
index f6d8983c0..5f0ba9821 100644
--- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua
+++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
@@ -276,7 +276,7 @@ function core_sandbox_module.name(name)
assert(name)
-- find modulename
- local i = name:find_last(".", true)
+ local i = name:lastof(".", true)
if i then
name = name:sub(i + 1)
end
@@ -402,7 +402,7 @@ function core_sandbox_module.import(name, opt)
local errors2 = nil
local module2_name = nil
local interface_name = nil
- local pos = name:find_last('.', true)
+ local pos = name:lastof('.', true)
if pos then
module2_name = name:sub(1, pos - 1)
interface_name = name:sub(pos + 1)
diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua
index fa80e2f25..16e174b31 100644
--- a/xmake/modules/utils/archive/extract.lua
+++ b/xmake/modules/utils/archive/extract.lua
@@ -334,11 +334,11 @@ function _extension(archivefile, extractors)
-- get extension
local extension = ""
- local i = filename:find_last(".", true)
+ local i = filename:lastof(".", true)
if i then
-- get next extension if exists
- local p = filename:sub(1, i - 1):find_last(".", true)
+ local p = filename:sub(1, i - 1):lastof(".", true)
if p and extractors[filename:sub(p)] then i = p end
-- ok