aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/service-helpers.js
blob: 28d48318287e959d0866e99cb776bae7d534e7a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import path from 'path';
import { app } from '@electron/remote';
import fs from 'fs-extra';

export function getServicePartitionsDirectory() {
  return path.join(app.getPath('userData'), 'Partitions');
}

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

  return fs.remove(servicePartition);
}

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