Fix file extension checking in remodel shim (#59)

This commit is contained in:
Callie 2023-06-23 16:00:15 -05:00 committed by GitHub
parent ef5d06a169
commit 3b29d10443
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -224,7 +224,7 @@ end
Models should be saved with `writeModelFile` instead. Models should be saved with `writeModelFile` instead.
]=] ]=]
function remodel.writePlaceFile(filePath: string, dataModel: LuneDataModel) function remodel.writePlaceFile(filePath: string, dataModel: LuneDataModel)
local asBinary = string.sub(filePath, -6) == ".rbxl" local asBinary = string.sub(filePath, -5) == ".rbxl"
local asXml = string.sub(filePath, -6) == ".rbxlx" local asXml = string.sub(filePath, -6) == ".rbxlx"
assert(asBinary or asXml, "File path must have .rbxl or .rbxlx extension") assert(asBinary or asXml, "File path must have .rbxl or .rbxlx extension")
local placeFile = roblox.serializePlace(dataModel, asXml) local placeFile = roblox.serializePlace(dataModel, asXml)
@ -238,7 +238,7 @@ end
Places should be saved with `writePlaceFile` instead. Places should be saved with `writePlaceFile` instead.
]=] ]=]
function remodel.writeModelFile(filePath: string, instance: LuneInstance) function remodel.writeModelFile(filePath: string, instance: LuneInstance)
local asBinary = string.sub(filePath, -6) == ".rbxm" local asBinary = string.sub(filePath, -5) == ".rbxm"
local asXml = string.sub(filePath, -6) == ".rbxmx" local asXml = string.sub(filePath, -6) == ".rbxmx"
assert(asBinary or asXml, "File path must have .rbxm or .rbxmx extension") assert(asBinary or asXml, "File path must have .rbxm or .rbxmx extension")
local placeFile = roblox.serializeModel({ instance }, asXml) local placeFile = roblox.serializeModel({ instance }, asXml)