feat: SodiumPet 小钠桌宠 v0.1.0(Live2D 桌宠 / 经济任务 / 音乐 / 成就 / 编辑器 / MOD)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
const fs = require('fs')
|
||||
const base = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/'
|
||||
function patch(file, pairs) {
|
||||
const p = base + file
|
||||
let c = fs.readFileSync(p, 'utf8')
|
||||
for (const [from, to] of pairs) {
|
||||
if (!c.includes(from)) {
|
||||
console.log('MISS in', file, '::', from.slice(0, 70).replace(/\n/g, '\\n'))
|
||||
continue
|
||||
}
|
||||
c = c.replace(from, to)
|
||||
}
|
||||
fs.writeFileSync(p, c, 'utf8')
|
||||
}
|
||||
|
||||
// 文件袋显示名去掉时间戳前缀
|
||||
const displayName = (name) => name.replace(/^\d+-/, '')
|
||||
patch('renderer/src/panel/Panel.tsx', [
|
||||
[
|
||||
` {fileIcon(f.name)} {f.name}`,
|
||||
` {fileIcon(f.name)} \${displayName(f.name)}`
|
||||
],
|
||||
[
|
||||
`function fileIcon(name: string): string {
|
||||
for (const [re, icon] of FILE_ICONS) if (re.test(name)) return icon
|
||||
return '📁'
|
||||
}`,
|
||||
`function fileIcon(name: string): string {
|
||||
for (const [re, icon] of FILE_ICONS) if (re.test(name)) return icon
|
||||
return '📁'
|
||||
}
|
||||
|
||||
function displayName(name: string): string {
|
||||
return name.replace(/^\\d+-/, '')
|
||||
}`
|
||||
]
|
||||
])
|
||||
patch('renderer/src/storage/Storage.tsx', [
|
||||
[
|
||||
` {fileIcon(f.name)} {f.name}`,
|
||||
` {fileIcon(f.name)} {f.name.replace(/^\\d+-/, '')}`
|
||||
]
|
||||
])
|
||||
console.log('display name patched')
|
||||
Reference in New Issue
Block a user