* Default upload descriptions based on file names if no FILE_ID.DIZ/etc. could be found

* Add default desc & prompt for desc to oputil fb scan
This commit is contained in:
Bryan Ashby 2017-02-24 23:39:31 -07:00
parent 9a2b48ac47
commit 97e19957ce
8 changed files with 67 additions and 13 deletions

View file

@ -32,6 +32,7 @@ exports.getFileEntryPath = getFileEntryPath;
exports.changeFileAreaWithOptions = changeFileAreaWithOptions;
exports.scanFile = scanFile;
exports.scanFileAreaForChanges = scanFileAreaForChanges;
exports.getDescFromFileName = getDescFromFileName;
const WellKnownAreaTags = exports.WellKnownAreaTags = {
Invalid : '',
@ -670,3 +671,11 @@ function scanFileAreaForChanges(areaInfo, options, iterator, cb) {
return cb(err);
});
}
function getDescFromFileName(fileName) {
// :TODO: this method could use some more logic to really be nice.
const ext = paths.extname(fileName);
const name = paths.basename(fileName, ext);
return _.upperFirst(name.replace(/[\-_.+]/g, ' ').replace(/\s+/g, ' '));
}