erweiterte ansicht
This commit is contained in:
@@ -87,6 +87,13 @@ function cleanAuto(a, old) {
|
||||
|
||||
let current = null
|
||||
|
||||
// Optional features, switched in Einstellungen → Allgemein. itch.io: without a stored
|
||||
// choice it is on when an itch.io profile is set (older settings), else off.
|
||||
function featuresFrom(f, itchProfile) {
|
||||
return { itch: typeof f?.itch === 'boolean' ? f.itch : !!(itchProfile ?? '').trim() }
|
||||
}
|
||||
const itchOn = (s = get()) => !!s.features?.itch
|
||||
|
||||
// projects in subfolders: { nested: chosen relative paths, nestedIgnored: seen, not chosen }
|
||||
function nestedOf(r) {
|
||||
const list = (v) => (Array.isArray(v) ? [...new Set(v.filter((x) => typeof x === 'string' && x && !x.split(/[\\/]/).includes('..')))].slice(0, 200) : [])
|
||||
@@ -122,6 +129,7 @@ function load() {
|
||||
roots,
|
||||
activeRoots: Array.isArray(saved?.activeRoots) ? saved.activeRoots : [saved?.activeRoot],
|
||||
itchProfile: typeof saved?.itchProfile === 'string' ? saved.itchProfile : d.itchProfile,
|
||||
features: featuresFrom(saved?.features, typeof saved?.itchProfile === 'string' ? saved.itchProfile : d.itchProfile),
|
||||
backup,
|
||||
})
|
||||
return current
|
||||
@@ -258,6 +266,7 @@ function save(input) {
|
||||
roots,
|
||||
activeRoots: sel.activeRoots,
|
||||
itchProfile,
|
||||
features: { ...(s.features ?? featuresFrom(null, itchProfile)), ...(typeof input.features?.itch === 'boolean' ? { itch: input.features.itch } : {}) },
|
||||
backup: {
|
||||
targets,
|
||||
excludeDirs: cleanList(input.excludeDirs, s.backup.excludeDirs),
|
||||
@@ -322,4 +331,4 @@ function subfolders(dir) {
|
||||
return { path: p, folders: list.slice(0, 200) }
|
||||
}
|
||||
|
||||
module.exports = { setNested, get, load, save, setActive, addRoots, activeRootList, subfolders, backupSubdir, configured, targetName, DATA_DIR, APP_DIR, DEFAULT_EXCLUDE_DIRS }
|
||||
module.exports = { setNested, itchOn, get, load, save, setActive, addRoots, activeRootList, subfolders, backupSubdir, configured, targetName, DATA_DIR, APP_DIR, DEFAULT_EXCLUDE_DIRS }
|
||||
|
||||
Reference in New Issue
Block a user