Don't copy over Thumbs.db!

This commit is contained in:
Domenic Denicola 2015-05-21 02:08:15 -04:00
commit 7e3dee3ed0

View file

@ -23,7 +23,7 @@ const COVER_MIMETYPE = "image/png";
module.exports = function (scaffoldingPath, bookPath, contentPath, chaptersPath, manifestPath) {
return Promise.all([
cpr(scaffoldingPath, bookPath),
cpr(scaffoldingPath, bookPath, { filter: noThumbs }),
getChapters(contentPath, chaptersPath, manifestPath).then(function (chapters) {
return Promise.all([
writeOpf(chapters, contentPath),
@ -34,6 +34,11 @@ module.exports = function (scaffoldingPath, bookPath, contentPath, chaptersPath,
.then(function () { });
};
function noThumbs(filePath) {
// Thumbs.db causes the strangest errors as Windows has it locked a lot of the time.
return path.basename(filePath) !== "Thumbs.db";
}
function writeOpf(chapters, contentPath) {
const manifestChapters = chapters.map(function (c) {
return `<item id="${c.id}" href="${c.href}" media-type="application/xhtml+xml"/>`;