2018-10-24 21:42:33 +08:00
|
|
|
'use strict';
|
|
|
|
|
2019-12-24 01:19:08 +08:00
|
|
|
var fs = require('fs');
|
2019-12-27 01:01:38 +08:00
|
|
|
const path = require('path');
|
2015-05-13 19:00:01 +08:00
|
|
|
var formats = {};
|
2014-08-03 02:26:01 +08:00
|
|
|
|
2019-12-24 01:19:08 +08:00
|
|
|
function formatFilesWithPath (dir) {
|
2019-12-27 01:01:38 +08:00
|
|
|
var formatDir = path.join(__dirname, dir);
|
2019-12-24 01:19:08 +08:00
|
|
|
return fs.readdirSync(formatDir).map(function (formatFile) {
|
2019-12-27 01:01:38 +08:00
|
|
|
return path.join(formatDir, formatFile);
|
2015-05-13 21:15:53 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var formatFilesPaths = []
|
|
|
|
.concat(formatFilesWithPath('ogr'))
|
|
|
|
.concat(formatFilesWithPath('pg'));
|
|
|
|
|
2019-12-24 01:19:08 +08:00
|
|
|
formatFilesPaths.forEach(function (file) {
|
2015-05-13 21:15:53 +08:00
|
|
|
var format = require(file);
|
2013-05-27 17:21:56 +08:00
|
|
|
formats[format.prototype.id] = format;
|
2013-05-16 17:24:52 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = formats;
|