Skip to content

Commit

Permalink
detect right dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
talyguryn committed Jan 13, 2021
1 parent 2d5605d commit bc75b5b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@
return FileToObject(file);
});

let shortestDirname = false;

filesList = chosenFiles
.filter(file => {
return (file.type).startsWith('image');
Expand All @@ -254,18 +256,28 @@
return 0;
})
.map(function (file) {
const dirname = path.dirname(file.path);

if (!shortestDirname || dirname.length < shortestDirname.length) {
shortestDirname = dirname;
}

return file.path;
});

const dirname = path.basename(path.dirname(filesList[0]));
selectedDirectoryName.innerText = dirname;
// .filter(filepath => {
// const dirname = path.dirname(filepath);
//
// return dirname === shortestDirname;
// });

images = filesList;

selectedDirectoryImages.innerText = `${images.length} images`;

selectedDirectory.classList.remove('hidden');
const dirname = path.basename(shortestDirname);
selectedDirectoryName.innerText = dirname;

selectedDirectory.classList.remove('hidden');
tlOptions.classList.remove('hidden');
};

Expand Down

0 comments on commit bc75b5b

Please sign in to comment.