diff options
author | 2018-01-03 23:46:54 +0100 | |
---|---|---|
committer | 2018-01-03 23:46:54 +0100 | |
commit | be801ff55d765e519f58a34d9854fb464a1ff77e (patch) | |
tree | 48c7972577c6b73cb5ca0d1947c5a8b198b98614 /src/helpers | |
parent | Fix lint issues (diff) | |
download | ferdium-app-be801ff55d765e519f58a34d9854fb464a1ff77e.tar.gz ferdium-app-be801ff55d765e519f58a34d9854fb464a1ff77e.tar.zst ferdium-app-be801ff55d765e519f58a34d9854fb464a1ff77e.zip |
feat(App): Add option to clear app cache (@dannyqiu)
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/service-helpers.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/helpers/service-helpers.js b/src/helpers/service-helpers.js index eb804103e..5f63f6b7c 100644 --- a/src/helpers/service-helpers.js +++ b/src/helpers/service-helpers.js | |||
@@ -4,16 +4,17 @@ import fs from 'fs-extra'; | |||
4 | 4 | ||
5 | const app = remote.app; | 5 | const app = remote.app; |
6 | 6 | ||
7 | function getServicePartitionsDirectory() { | 7 | export function getServicePartitionsDirectory() { |
8 | return path.join(app.getPath('userData'), 'Partitions'); | 8 | return path.join(app.getPath('userData'), 'Partitions'); |
9 | } | 9 | } |
10 | 10 | ||
11 | export function removeServicePartitionDirectory(id = '') { | 11 | export function removeServicePartitionDirectory(id = '', addServicePrefix = false) { |
12 | const servicePartition = path.join(getServicePartitionsDirectory(), `service-${id}`); | 12 | const servicePartition = path.join(getServicePartitionsDirectory(), `${addServicePrefix ? 'service-' : ''}${id}`); |
13 | |||
13 | return fs.remove(servicePartition); | 14 | return fs.remove(servicePartition); |
14 | } | 15 | } |
15 | 16 | ||
16 | export async function getServiceIdsFromPartitions() { | 17 | export async function getServiceIdsFromPartitions() { |
17 | const files = await fs.readdir(getServicePartitionsDirectory()); | 18 | const files = await fs.readdir(getServicePartitionsDirectory()); |
18 | return files.map(filename => filename.replace('service-', '')); | 19 | return files.filter(n => n !== '__chrome_extension'); |
19 | } | 20 | } |