change game to app
This commit is contained in:
parent
fd773f5832
commit
a8335a0e89
7 changed files with 30 additions and 32 deletions
|
|
@ -58,11 +58,11 @@ async function importGame(srcDir, mode, onProgress) {
|
|||
const name = path.basename(srcDir)
|
||||
let workdir = srcDir
|
||||
if (mode === 'copy') {
|
||||
const dst = dedupeName(DIRS.GAMES, name)
|
||||
const dst = dedupeName(DIRS.APPS, name)
|
||||
await copyRecursive(srcDir, dst, onProgress)
|
||||
workdir = dst
|
||||
} else if (mode === 'move') {
|
||||
const dst = dedupeName(DIRS.GAMES, name)
|
||||
const dst = dedupeName(DIRS.APPS, name)
|
||||
await moveFolder(srcDir, dst, onProgress)
|
||||
workdir = dst
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const path = require('path')
|
|||
const { DIRS, readJson, writeJson } = require('./paths')
|
||||
const { prefixPath } = require('./prefixes')
|
||||
|
||||
const REGISTRY = path.join(DIRS.DATA, 'games.json')
|
||||
const REGISTRY = path.join(DIRS.DATA, 'apps.json')
|
||||
const SETTINGS = path.join(DIRS.DATA, 'settings.json')
|
||||
|
||||
function loadGames() {
|
||||
|
|
@ -40,7 +40,7 @@ function removeGame(id) {
|
|||
const idx = games.findIndex(g => g.id === id)
|
||||
if (idx === -1) return false
|
||||
const g = games[idx]
|
||||
if (g.imported && g.path && g.path.startsWith(DIRS.GAMES)) {
|
||||
if (g.imported && g.path && g.path.startsWith(DIRS.APPS)) {
|
||||
try {
|
||||
require('fs').rmSync(g.path, { recursive: true, force: true })
|
||||
} catch {}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,14 @@ const DIRS = {
|
|||
DATA,
|
||||
WINES: path.join(FILES, 'wines'),
|
||||
PREFIXES: path.join(FILES, 'wineprefixes'),
|
||||
GAMES: path.join(FILES, 'games'),
|
||||
APPS: path.join(FILES, 'apps'),
|
||||
TRANSLATIONS: path.join(FILES, 'translations'),
|
||||
BUNDLED_TRANSLATIONS: path.join(BUNDLED, 'translations'),
|
||||
FAKE_STEAM: path.join(DATA, 'fake-steam')
|
||||
}
|
||||
|
||||
function ensureDirs() {
|
||||
const legacy = path.join(FILES, 'wine prefixes')
|
||||
try {
|
||||
if (fs.existsSync(legacy) && !fs.existsSync(DIRS.PREFIXES)) fs.renameSync(legacy, DIRS.PREFIXES)
|
||||
} catch {}
|
||||
for (const dir of [FILES, DATA, DIRS.WINES, DIRS.PREFIXES, DIRS.GAMES, DIRS.TRANSLATIONS, DIRS.FAKE_STEAM]) {
|
||||
for (const dir of [FILES, DATA, DIRS.WINES, DIRS.PREFIXES, DIRS.APPS, DIRS.TRANSLATIONS, DIRS.FAKE_STEAM]) {
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
}
|
||||
if (DIRS.TRANSLATIONS !== DIRS.BUNDLED_TRANSLATIONS) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue