mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
Improved zip-reader to better support relative paths
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@ function checkFolderPath(dest)
|
||||
}
|
||||
function extractNext(p)
|
||||
{
|
||||
if (p.pending.length == 0) { p._res(); return; }
|
||||
if (p.pending.length == 0) { p.source.close(); p._res(); return; }
|
||||
var next = p.pending.pop();
|
||||
var dest = p.baseFolder + (process.platform == 'win32' ? '\\' : '/') + next;
|
||||
if (process.platform == 'win32') { dest = dest.split('/').join('\\'); }
|
||||
@@ -48,6 +48,7 @@ function extractNext(p)
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
p.source.close();
|
||||
p._rej(e);
|
||||
return;
|
||||
}
|
||||
@@ -226,6 +227,15 @@ function zippedObject(table)
|
||||
};
|
||||
this.extractAll = function extractAll(destFolder)
|
||||
{
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
if (!destFolder.includes(':\\')) { destFolder = process.cwd() + destFolder; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!destFolder.startsWith('/')) { destFolder = process.cwd() + destFolder; }
|
||||
}
|
||||
|
||||
var i;
|
||||
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
||||
if (destFolder.endsWith(process.platform == 'win32' ? '\\' : '/')) { destFolder = destFolder.substring(0, destFolder.length - 1); }
|
||||
|
||||
Reference in New Issue
Block a user