mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-29 01:27:00 +03:00
Remove cache directory before downloading
This ensures any previously failed downloads/extractions are cleaned up before a new atom-shell distribution is downloaded and extracted.
This commit is contained in:
parent
a7eaac3984
commit
fe4f9471e6
@ -26,10 +26,12 @@ module.exports = (grunt) ->
|
||||
inputStream.on 'response', (response) ->
|
||||
if response.statusCode is 200
|
||||
grunt.log.writeln("Downloading atom-shell version #{version.cyan}")
|
||||
cachePath = "#{getCachePath(version)}/atom-shell.zip"
|
||||
mkdir(path.dirname(cachePath))
|
||||
outputStream = fs.createWriteStream(cachePath)
|
||||
outputStream.on 'close', -> callback(null, cachePath)
|
||||
cacheDirectory = getCachePath(version)
|
||||
rm(cacheDirectory)
|
||||
mkdir(cacheDirectory)
|
||||
cacheFile = path.join(cacheDirectory, 'atom-shell.zip')
|
||||
outputStream = fs.createWriteStream(cacheFile)
|
||||
outputStream.on 'close', -> callback(null, cacheFile)
|
||||
inputStream.pipe(outputStream)
|
||||
else
|
||||
if response.statusCode is 404
|
||||
@ -45,7 +47,7 @@ module.exports = (grunt) ->
|
||||
try
|
||||
zip = new AdmZip(zipPath);
|
||||
zip.extractAllTo(directoryPath, true)
|
||||
rm(zipPath, force: true)
|
||||
rm(zipPath)
|
||||
callback()
|
||||
catch error
|
||||
callback(error)
|
||||
|
Loading…
Reference in New Issue
Block a user