aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/service-helpers.js
blob: 745f40dd90006b08f20f413e3c2834d6d132844c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { readdirSync, removeSync } from 'fs-extra';
import { userDataPath } from '../environment';

export function getServicePartitionsDirectory(...segments) {
  return userDataPath('Partitions', ...([segments].flat()));
}

export function removeServicePartitionDirectory(id = '', addServicePrefix = false) {
  const servicePartition = getServicePartitionsDirectory(`${addServicePrefix ? 'service-' : ''}${id}`);
  return removeSync(servicePartition);
}

export async function getServiceIdsFromPartitions() {
  const files = readdirSync(getServicePartitionsDirectory());
  return files.filter((n) => n !== '__chrome_extension');
}