aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/service-helpers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/service-helpers.ts')
-rw-r--r--src/helpers/service-helpers.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/helpers/service-helpers.ts b/src/helpers/service-helpers.ts
new file mode 100644
index 000000000..13c921f88
--- /dev/null
+++ b/src/helpers/service-helpers.ts
@@ -0,0 +1,21 @@
1import { readdirSync, removeSync } from 'fs-extra';
2import { userDataPath } from '../environment';
3
4export function getServicePartitionsDirectory(...segments) {
5 return userDataPath('Partitions', ...[segments].flat());
6}
7
8export function removeServicePartitionDirectory(
9 id = '',
10 addServicePrefix = false,
11) {
12 const servicePartition = getServicePartitionsDirectory(
13 `${addServicePrefix ? 'service-' : ''}${id}`,
14 );
15 return removeSync(servicePartition);
16}
17
18export async function getServiceIdsFromPartitions() {
19 const files = readdirSync(getServicePartitionsDirectory());
20 return files.filter(n => n !== '__chrome_extension');
21}