This commit is contained in:
@@ -38,12 +38,16 @@ const answerFiles = import.meta.globEager('./Data/*/*/answers/*.mp3') as Record<
|
||||
const getParts = (path: string) => {
|
||||
const normalized = path.replace(/\\/g, '/')
|
||||
const parts = normalized.split('/')
|
||||
const dataIndex = parts.findIndex((part) => part.toLowerCase() === 'data')
|
||||
const lowerParts = parts.map((part) => part.toLowerCase())
|
||||
const dataIndex = lowerParts.indexOf('data')
|
||||
if (dataIndex === -1) return null
|
||||
const game = parts[dataIndex + 1]
|
||||
const category = parts[dataIndex + 2]
|
||||
const type = parts[dataIndex + 3]
|
||||
const file = parts[dataIndex + 4]
|
||||
const typeIndex = lowerParts.findIndex((part) => part === 'songs' || part === 'answers')
|
||||
if (typeIndex === -1) return null
|
||||
const type = lowerParts[typeIndex]
|
||||
const file = parts[typeIndex + 1]
|
||||
if (!game || !category || !file) return null
|
||||
return { game, category, type, file }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user