aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/service-helpers.js
blob: f6363aca8a7cfb53940cadea430a64c3cc10a491 (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');
}