Skip to content

Commit

Permalink
platform.OS -> platform.os
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Feb 26, 2024
1 parent fec4e41 commit ab34c3f
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions make/detect_platform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -52,7 +52,7 @@ local ARCH <const> = {
}

local function detectArch()
if platform.OS == 'Windows' then
if platform.os == 'windows' then
return detectWindowsArch()
end
local posixArch = detectPosixArch()
Expand All @@ -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
2 changes: 1 addition & 1 deletion script/encoder/ansi.lua
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions script/file-uri.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions script/files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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\\')
Expand Down
1 change: 0 additions & 1 deletion script/fs-utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion script/proto/proto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion script/workspace/require-path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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('[/\\]+', '/')
Expand Down
4 changes: 2 additions & 2 deletions script/workspace/workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion test/crossfile/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ local z: table
}
}

if platform.OS == 'Windows' then
if platform.os == 'windows' then
Cared['detail'] = true
Cared['additionalTextEdits'] = true
TEST {
Expand Down
2 changes: 1 addition & 1 deletion test/crossfile/definition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ TEST {
}


if platform.OS == 'Linux' then
if platform.os == 'linux' then

TEST {
{
Expand Down
2 changes: 1 addition & 1 deletion test/tclient/tests/jump-source.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit ab34c3f

Please sign in to comment.