Skip to content

Commit

Permalink
[editor] Fix duplicate map meta entries resulting in editor suspendin…
Browse files Browse the repository at this point in the history
…g. (#543)

* [editor] Fix duplicate map meta entries resulting in editor suspending.

* added debug messages
  • Loading branch information
chris1384 authored Sep 4, 2024
1 parent e558c84 commit b64e5b4
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions [editor]/editor_main/server/resourcehooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ function getResourceFiles ( resource, fileType )
local file = xmlNodeGetAttribute ( node, "src" )
local otherAttributes = xmlNodeGetAttributes ( node )
otherAttributes.src = nil
fileAttributes[file] = otherAttributes
table.insert ( files, file )
if fileAttributes[file] then
outputDebugString("getResourceFiles: Found duplicate meta entry in '".. resource .."' (".. fileType .. " - ".. file .. ")")
else
fileAttributes[file] = otherAttributes
table.insert ( files, file )
end
i = i + 1
end
xmlUnloadFile ( meta )
Expand All @@ -118,10 +122,15 @@ function copyResourceFiles ( fromResource, targetResource )
local paths, attr = getResourceFiles(fromResource, fileType)
if paths then
for j,filePath in ipairs(paths) do
fileCopy ( ":" .. getResourceName(fromResource) .. "/" .. filePath, ":" .. getResourceName(targetResource) .. "/" .. filePath, false )
local data = attr[filePath]
data.src = filePath
table.insert ( targetPaths[fileType], data )
local copyPath, copyTarget = ":" .. getResourceName(fromResource) .. "/" .. filePath, ":" .. getResourceName(targetResource) .. "/" .. filePath
if fileExists(copyTarget) then
outputDebugString("copyResourceFiles: File '".. copyTarget .."' has duplicate meta entries, cannot overwrite.")
else
fileCopy ( copyPath, copyTarget, false )
local data = attr[filePath]
data.src = filePath
table.insert ( targetPaths[fileType], data )
end
end
else
outputDebugString("copyResourceFiles: getResourceFiles returned "..tostring(paths).." and "..tostring(attr).." for "..tostring(fromResource).." and "..tostring(fileType))
Expand Down

0 comments on commit b64e5b4

Please sign in to comment.