From 823c3e82482e5fbb2ee4bf5f907e6944e4c2b5c9 Mon Sep 17 00:00:00 2001 From: Karl Prieb Date: Wed, 31 Aug 2022 11:27:46 -0300 Subject: [PATCH] fix(temp_folder): use rmSync instead of rmdirSync --- src/utils/temp_folder.test.ts | 4 +--- src/utils/temp_folder.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/temp_folder.test.ts b/src/utils/temp_folder.test.ts index 069b6516..c81b888b 100644 --- a/src/utils/temp_folder.test.ts +++ b/src/utils/temp_folder.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; import { cleanUpTempFolder, getTempFolder } from './temp_folder'; import * as fs from 'fs'; -import * as os from 'os'; describe('temp folder functions', () => { describe('getTempFolder function', () => { @@ -19,8 +18,7 @@ describe('temp folder functions', () => { it('returns a folder that contains the correct subfolders', () => { const tempFolderPath = getTempFolder(); - const expectedPathComponent = - os.platform() === 'win32' ? '\\ardrive-downloads' : '/.ardrive/ardrive-downloads'; + const expectedPathComponent = 'ardrive-downloads'; expect(tempFolderPath).to.contains(expectedPathComponent); }); }); diff --git a/src/utils/temp_folder.ts b/src/utils/temp_folder.ts index e8c8ec9b..6d682bb6 100644 --- a/src/utils/temp_folder.ts +++ b/src/utils/temp_folder.ts @@ -74,6 +74,6 @@ export function getTempFolder(): string { export function cleanUpTempFolder(): void { const tempFolderPath = platformTempFolder(); if (fs.existsSync(tempFolderPath)) { - fs.rmdirSync(tempFolderPath, { recursive: true }); + fs.rmSync(tempFolderPath, { recursive: true }); } }