From ab34c3f920a5a20a284e67ebbc3dc53df89e00f6 Mon Sep 17 00:00:00 2001 From: actboy168 Date: Mon, 26 Feb 2024 11:17:59 +0800 Subject: platform.OS -> platform.os --- make.lua | 2 +- make/detect_platform.lua | 10 +++++----- script/encoder/ansi.lua | 2 +- script/file-uri.lua | 4 ++-- script/files.lua | 6 +++--- script/fs-utility.lua | 1 - script/proto/proto.lua | 2 +- script/workspace/require-path.lua | 2 +- script/workspace/workspace.lua | 4 ++-- test/crossfile/completion.lua | 2 +- test/crossfile/definition.lua | 2 +- test/tclient/tests/jump-source.lua | 2 +- 12 files changed, 19 insertions(+), 20 deletions(-) diff --git a/make.lua b/make.lua index 615f1f35..e532bbf1 100644 --- a/make.lua +++ b/make.lua @@ -55,7 +55,7 @@ lm:executable "lua-language-server" { } local platform = require 'bee.platform' -local exe = platform.OS == 'Windows' and ".exe" or "" +local exe = platform.os == 'windows' and ".exe" or "" lm:copy "copy_lua-language-server" { inputs = "$bin/lua-language-server" .. exe, diff --git a/make/detect_platform.lua b/make/detect_platform.lua index 52207f95..4b62298f 100644 --- a/make/detect_platform.lua +++ b/make/detect_platform.lua @@ -2,7 +2,7 @@ local lm = require 'luamake' local platform = require 'bee.platform' -if platform.OS == 'macOS' then +if platform.os == 'macos' then if lm.platform == nil then elseif lm.platform == "darwin-arm64" then lm.target = "arm64-apple-macos11" @@ -11,7 +11,7 @@ if platform.OS == 'macOS' then else error "unknown platform" end -elseif platform.OS == 'Windows' then +elseif platform.os == 'windows' then if lm.platform == nil then elseif lm.platform == "win32-ia32" then lm.arch = "x86" @@ -20,7 +20,7 @@ elseif platform.OS == 'Windows' then else error "unknown platform" end -elseif platform.OS == 'Linux' then +elseif platform.os == 'linux' then if lm.platform == nil then elseif lm.platform == "linux-x64" then elseif lm.platform == "linux-arm64" then @@ -52,7 +52,7 @@ local ARCH = { } local function detectArch() - if platform.OS == 'Windows' then + if platform.os == 'windows' then return detectWindowsArch() end local posixArch = detectPosixArch() @@ -67,5 +67,5 @@ local function targetPlatformArch() end if not lm.notest then - lm.notest = (platform.OS ~= 'Windows' and targetPlatformArch() ~= detectArch()) + lm.notest = (platform.os ~= 'windows' and targetPlatformArch() ~= detectArch()) end diff --git a/script/encoder/ansi.lua b/script/encoder/ansi.lua index 7cb64ec3..f89ddbc1 100644 --- a/script/encoder/ansi.lua +++ b/script/encoder/ansi.lua @@ -1,7 +1,7 @@ local platform = require 'bee.platform' local windows -if platform.OS == 'Windows' then +if platform.os == 'windows' then windows = require 'bee.windows' end diff --git a/script/file-uri.lua b/script/file-uri.lua index 8a075f7e..192f3ab5 100644 --- a/script/file-uri.lua +++ b/script/file-uri.lua @@ -25,7 +25,7 @@ local m = {} ---@return uri uri function m.encode(path) local authority = '' - if platform.OS == 'Windows' then + if platform.os == 'windows' then path = path:gsub('\\', '/') end @@ -82,7 +82,7 @@ function m.decode(uri) else value = path end - if platform.OS == 'Windows' then + if platform.os == 'windows' then value = value:gsub('/', '\\') end return value diff --git a/script/files.lua b/script/files.lua index 8cc7a5ab..b9df5695 100644 --- a/script/files.lua +++ b/script/files.lua @@ -78,7 +78,7 @@ end ---@param uri uri ---@return uri function m.getRealUri(uri) - if platform.OS ~= 'Windows' then + if platform.os ~= 'windows' then return furi.normalize(uri) end if not furi.isValid(uri) then @@ -833,7 +833,7 @@ function m.isDll(uri) if not ext then return false end - if platform.OS == 'Windows' then + if platform.os == 'windows' then if ext == 'dll' then return true end @@ -932,7 +932,7 @@ function m.normalize(path) break end end - if platform.OS == 'Windows' then + if platform.os == 'windows' then path = path:gsub('[/\\]+', '\\') :gsub('[/\\]+$', '') :gsub('^(%a:)$', '%1\\') diff --git a/script/fs-utility.lua b/script/fs-utility.lua index 8d2bf319..35b336fe 100644 --- a/script/fs-utility.lua +++ b/script/fs-utility.lua @@ -570,7 +570,6 @@ end --- 文件列表 function m.fileList(option) option = option or buildOption(option) - local os = platform.OS local keyMap = {} local fileList = {} local function computeKey(path) diff --git a/script/proto/proto.lua b/script/proto/proto.lua index 2460b4ec..b0d5d1a9 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -232,7 +232,7 @@ end function m.listen(mode, socketPort) m.mode = mode if mode == 'stdio' then - if platform.OS == 'Windows' then + if platform.os == 'windows' then local windows = require 'bee.windows' windows.filemode(io.stdin, 'b') windows.filemode(io.stdout, 'b') diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua index c319cbad..1507183c 100644 --- a/script/workspace/require-path.lua +++ b/script/workspace/require-path.lua @@ -123,7 +123,7 @@ function mt:getRequireResultByPath(path) cutedPath = currentPath:sub(pos) head = currentPath:sub(1, pos - 1) pos = currentPath:match('[/\\]+()', pos) - if platform.OS == 'Windows' then + if platform.os == 'windows' then searcher = searcher :gsub('[/\\]+', '\\') else searcher = searcher :gsub('[/\\]+', '/') diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 97518e84..fe7c6c15 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -188,7 +188,7 @@ function m.getNativeMatcher(scp) local matcher = glob.gitignore(pattern, { root = scp.uri and furi.decode(scp.uri), - ignoreCase = platform.OS == 'Windows', + ignoreCase = platform.os == 'windows', }, globInteferFace) scp:set('nativeMatcher', matcher) @@ -236,7 +236,7 @@ function m.getLibraryMatchers(scp) local nPath = fs.absolute(fs.path(path)):string() local matcher = glob.gitignore(pattern, { root = path, - ignoreCase = platform.OS == 'Windows', + ignoreCase = platform.os == 'windows', }, globInteferFace) matchers[#matchers+1] = { uri = furi.encode(nPath), diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 227350cb..79b40cb3 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -918,7 +918,7 @@ local z: table } } -if platform.OS == 'Windows' then +if platform.os == 'windows' then Cared['detail'] = true Cared['additionalTextEdits'] = true TEST { diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index b13b57f3..49a5d8d3 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -689,7 +689,7 @@ TEST { } -if platform.OS == 'Linux' then +if platform.os == 'linux' then TEST { { diff --git a/test/tclient/tests/jump-source.lua b/test/tclient/tests/jump-source.lua index 84a4dcd5..c9e093c0 100644 --- a/test/tclient/tests/jump-source.lua +++ b/test/tclient/tests/jump-source.lua @@ -163,7 +163,7 @@ print(D3) position = { line = 9, character = 7 }, }) - if platform.OS == 'Windows' then + if platform.os == 'windows' then assert(util.equal(locations, { { uri = 'file:///d%3A/xxx/2.lua', -- cgit v1.2.3