mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Use rimraf for removing files/folders
This commit is contained in:
parent
b96597b089
commit
437137783c
@ -23,6 +23,7 @@
|
||||
"keytar": "0.4.0",
|
||||
"ls-archive": "0.9.0",
|
||||
"temp": "0.5.0",
|
||||
"rimraf": "2.1.4",
|
||||
"plist": "git://github.com/nathansobo/node-plist.git",
|
||||
"space-pen": "1.0.0",
|
||||
"less": "git://github.com/nathansobo/less.js.git",
|
||||
|
@ -3,6 +3,7 @@ fs = require 'fs'
|
||||
mkdirp = require 'mkdirp'
|
||||
Module = require 'module'
|
||||
async = require 'async'
|
||||
rimraf = require 'rimraf'
|
||||
|
||||
module.exports =
|
||||
# Make the given path absolute by resolving it against the
|
||||
@ -134,20 +135,8 @@ module.exports =
|
||||
|
||||
# Remove a file at the given path. Throws an error if path is not a
|
||||
# file or a symbolic link to a file.
|
||||
remove: (path) ->
|
||||
if @isFile(path)
|
||||
fs.unlinkSync(path)
|
||||
else if @isDirectory(path)
|
||||
removeDirectory = (path) =>
|
||||
for entry in fs.readdirSync(path)
|
||||
entryPath = @join(path, entry)
|
||||
stats = fs.statSync(entryPath)
|
||||
if stats.isDirectory()
|
||||
removeDirectory(entryPath)
|
||||
else if stats.isFile()
|
||||
fs.unlinkSync(entryPath)
|
||||
fs.rmdirSync(path)
|
||||
removeDirectory(path)
|
||||
remove: (pathToRemove) ->
|
||||
rimraf.sync(pathToRemove)
|
||||
|
||||
# Open, read, and close a file, returning the file's contents.
|
||||
read: (path) ->
|
||||
|
Loading…
Reference in New Issue
Block a user