mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 20:34:02 +00:00
delete directory with rimraf
This commit is contained in:
parent
af4c72150f
commit
8744cf94a5
2 changed files with 6 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
logger = require("logger-sharelatex")
|
||||
fs = require("fs")
|
||||
LocalFileWriter = require("./LocalFileWriter")
|
||||
rimraf = require("rimraf")
|
||||
|
||||
filterName = (key) ->
|
||||
return key.replace /\//g, "_"
|
||||
|
@ -57,10 +58,10 @@ module.exports =
|
|||
callback err
|
||||
|
||||
deleteDirectory: (location, name, callback = (err)->)->
|
||||
filteredName = filterName name
|
||||
fs.rmdir "#{location}/#{filteredName}", (err) ->
|
||||
logger.err err:err, location:location, name:filteredName, "Error on rmdir."
|
||||
if err and err.code != 'ENOENT'
|
||||
filteredName = filterName name.replace(/\/$/,'')
|
||||
rimraf "#{location}/#{filteredName}", (err) ->
|
||||
if err
|
||||
logger.err err:err, location:location, name:filteredName, "Error on rimraf rmdir."
|
||||
callback err
|
||||
else
|
||||
callback()
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"node-uuid": "~1.4.1",
|
||||
"pngcrush": "0.0.3",
|
||||
"request": "2.14.0",
|
||||
"rimraf": "2.2.8",
|
||||
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#master",
|
||||
"stream-buffers": "~0.2.5",
|
||||
"underscore": "~1.5.2"
|
||||
|
|
Loading…
Reference in a new issue