mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-06 07:10:12 -06:00
Co-authored-by: Jessica Sachs <jess@jessicasachs.io> Co-authored-by: Barthélémy Ledoux <bart@cypress.io> Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> Co-authored-by: Zach Bloomquist <github@chary.us> Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com> Co-authored-by: ElevateBart <ledouxb@gmail.com> Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
21 lines
524 B
JavaScript
21 lines
524 B
JavaScript
const { fs } = require('./fs')
|
|
const os = require('os')
|
|
const path = require('path')
|
|
const trash = require('trash')
|
|
const Promise = require('bluebird')
|
|
|
|
module.exports = {
|
|
folder (pathToFolder) {
|
|
return fs.statAsync(pathToFolder)
|
|
.then(() => {
|
|
if (os.platform() === 'linux') {
|
|
return fs.emptyDir(pathToFolder)
|
|
}
|
|
|
|
return Promise.map(fs.readdirAsync(pathToFolder), (item) => {
|
|
return trash([path.join(pathToFolder, item)])
|
|
})
|
|
}).catch({ code: 'ENOENT' }, () => {})
|
|
},
|
|
}
|