mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-27 08:48:46 +00:00
Fix #319 keep unknown files when importing and downloading a project
This commit is contained in:
@@ -50,10 +50,15 @@ export function ProjectCreation({ onClose }: Props) {
|
||||
try {
|
||||
const data = await parseSource(entry[1], 'json')
|
||||
project.files!.push({ ...file, data })
|
||||
return
|
||||
} catch (e) {
|
||||
console.error(`Failed parsing ${file.type} ${file.id}: ${message(e)}`)
|
||||
console.warn(`Failed parsing ${file.type} ${file.id}: ${message(e)}`)
|
||||
}
|
||||
}
|
||||
if (project.unknownFiles === undefined) {
|
||||
project.unknownFiles = []
|
||||
}
|
||||
project.unknownFiles.push({ path: entry[0], data: entry[1] })
|
||||
}))
|
||||
projectUpdater.current(project)
|
||||
onClose()
|
||||
|
||||
@@ -77,6 +77,9 @@ export function ProjectPanel({ onRename, onCreate, onDeleteProject }: Props) {
|
||||
if (path === 'pack.mcmeta') hasPack = true
|
||||
return [[path, stringifySource(file.data)]] as [string, string][]
|
||||
})
|
||||
project.unknownFiles?.forEach(({ path, data }) => {
|
||||
entries.push([path, data])
|
||||
})
|
||||
if (!hasPack) {
|
||||
const pack_format = config.versions.find(v => v.id === version)!.pack_format
|
||||
entries.push(['pack.mcmeta', stringifySource({ pack: { pack_format, description: '' } })])
|
||||
|
||||
Reference in New Issue
Block a user