diff options
author | 2017-12-29 01:33:22 -0500 | |
---|---|---|
committer | 2017-12-29 01:33:22 -0500 | |
commit | c6e2e18430e3eef7ec545704dded359d9c706683 (patch) | |
tree | 15567b9d17ac934983caeeb85615ea1777efe94e /src/helpers/service-helpers.js | |
parent | Add button to clear service cache (diff) | |
download | ferdium-app-c6e2e18430e3eef7ec545704dded359d9c706683.tar.gz ferdium-app-c6e2e18430e3eef7ec545704dded359d9c706683.tar.zst ferdium-app-c6e2e18430e3eef7ec545704dded359d9c706683.zip |
Delete session partition with service
Diffstat (limited to 'src/helpers/service-helpers.js')
-rw-r--r-- | src/helpers/service-helpers.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/helpers/service-helpers.js b/src/helpers/service-helpers.js new file mode 100644 index 000000000..eb804103e --- /dev/null +++ b/src/helpers/service-helpers.js | |||
@@ -0,0 +1,19 @@ | |||
1 | import path from 'path'; | ||
2 | import { remote } from 'electron'; | ||
3 | import fs from 'fs-extra'; | ||
4 | |||
5 | const app = remote.app; | ||
6 | |||
7 | function getServicePartitionsDirectory() { | ||
8 | return path.join(app.getPath('userData'), 'Partitions'); | ||
9 | } | ||
10 | |||
11 | export function removeServicePartitionDirectory(id = '') { | ||
12 | const servicePartition = path.join(getServicePartitionsDirectory(), `service-${id}`); | ||
13 | return fs.remove(servicePartition); | ||
14 | } | ||
15 | |||
16 | export async function getServiceIdsFromPartitions() { | ||
17 | const files = await fs.readdir(getServicePartitionsDirectory()); | ||
18 | return files.map(filename => filename.replace('service-', '')); | ||
19 | } | ||