kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Support for pre-compiled 7z/unzip
rodzic
e30718c567
commit
90ecdb4c34
|
@ -43,3 +43,4 @@ jspm_packages
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
apps/
|
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
let fs = require('fs');
|
let fs = require('fs');
|
||||||
let argv = require('minimist')(process.argv.slice(2));
|
let argv = require('minimist')(process.argv.slice(2));
|
||||||
let utils = require('./libs/utils');
|
let utils = require('./libs/utils');
|
||||||
|
let apps = require('./libs/apps');
|
||||||
const spawnSync = require('child_process').spawnSync;
|
const spawnSync = require('child_process').spawnSync;
|
||||||
|
|
||||||
if (argv.help){
|
if (argv.help){
|
||||||
|
@ -141,8 +142,8 @@ config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConc
|
||||||
config.maxRuntime = parseInt(argv.max_runtime || fromConfigFile("maxRuntime", -1));
|
config.maxRuntime = parseInt(argv.max_runtime || fromConfigFile("maxRuntime", -1));
|
||||||
|
|
||||||
// Detect 7z availability
|
// Detect 7z availability
|
||||||
config.has7z = spawnSync("7z", ['--help']).status === 0;
|
config.has7z = spawnSync(apps.sevenZ, ['--help']).status === 0;
|
||||||
config.hasUnzip = spawnSync("unzip", ['--help']).status === 0;
|
config.hasUnzip = spawnSync(apps.unzip, ['--help']).status === 0;
|
||||||
|
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
|
||||||
|
Copyright (C) 2016 Node-OpenDroneMap Contributors
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
let sevenZ = "7z";
|
||||||
|
let unzip = "unzip";
|
||||||
|
|
||||||
|
if (fs.existsSync(path.join("apps", "7z", "7z.exe"))){
|
||||||
|
sevenZ = path.resolve(path.join("apps", "7z", "7z.exe"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(path.join("apps", "unzip", "unzip.exe"))){
|
||||||
|
unzip = path.resolve(path.join("apps", "unzip", "unzip.exe"));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
sevenZ, unzip
|
||||||
|
};
|
|
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
let fs = require('fs');
|
let fs = require('fs');
|
||||||
|
let apps = require('./apps');
|
||||||
let path = require('path');
|
let path = require('path');
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
let spawn = require('child_process').spawn;
|
let spawn = require('child_process').spawn;
|
||||||
|
@ -92,14 +93,14 @@ module.exports = {
|
||||||
},
|
},
|
||||||
["projectFolderPath"]),
|
["projectFolderPath"]),
|
||||||
|
|
||||||
sevenZip: makeRunner("7z", function(options){
|
sevenZip: makeRunner(apps.sevenZ, function(options){
|
||||||
return ["a", "-mx=0", "-y", "-r", "-bd", options.destination].concat(options.pathsToArchive);
|
return ["a", "-mx=0", "-y", "-r", "-bd", options.destination].concat(options.pathsToArchive);
|
||||||
},
|
},
|
||||||
["destination", "pathsToArchive", "cwd"],
|
["destination", "pathsToArchive", "cwd"],
|
||||||
null,
|
null,
|
||||||
false),
|
false),
|
||||||
|
|
||||||
sevenUnzip: makeRunner("7z", function(options){
|
sevenUnzip: makeRunner(apps.sevenZ, function(options){
|
||||||
let cmd = "x"; // eXtract files with full paths
|
let cmd = "x"; // eXtract files with full paths
|
||||||
if (options.noDirectories) cmd = "e"; //Extract files from archive (without using directory names)
|
if (options.noDirectories) cmd = "e"; //Extract files from archive (without using directory names)
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ module.exports = {
|
||||||
null,
|
null,
|
||||||
false),
|
false),
|
||||||
|
|
||||||
unzip: makeRunner("unzip", function(options){
|
unzip: makeRunner(apps.unzip, function(options){
|
||||||
const opts = options.noDirectories ? ["-j"] : [];
|
const opts = options.noDirectories ? ["-j"] : [];
|
||||||
return opts.concat(["-qq", "-o", options.file, "-d", options.destination]);
|
return opts.concat(["-qq", "-o", options.file, "-d", options.destination]);
|
||||||
},
|
},
|
||||||
|
|
Ładowanie…
Reference in New Issue