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

const app = remote.app;

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');
}