-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I've been trying to get this library working for several hours, and ran into what I believe is a bug with how the software handles file directories on Windows computers. Here's some information about my system:
| - | - |
| OS Name | Microsoft Windows 10 Home
| Version | 10.0.19045 Build 19045
| System Type | x64-based PC
The problem
My simple use case is to run the build command on a single image inside of a collection. Here's the file structure:
my-collection
- 0-first-image-manifest
- _revenge-test
- revenge.jpg
- info.ymlAnd the code:
const path = "./my-collection/0-first-image-manifest"
await build (path, "http://example.com/0-first-image-manifest")Here's the output of running this code on this file structure (on a Windows 10 PC):
$ node generate.js
started biiifing .\my-collection\0-first-image-manifest
creating canvas for: ./my-collection/0-first-image-manifest/_revenge-test
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test/info.yml
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test/info.yml
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test/info.yml
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test/revenge.jpg
no metadata found for: ./my-collection/0-first-image-manifest/_revenge-test/info.yml
no metadata found for: ./my-collection/0-first-image-manifest/_revenge-test/revenge.jpg
creating index.json for: ./my-collection/0-first-image-manifest/_revenge-test/info.yml
creating index.json for: ./my-collection/0-first-image-manifest/_revenge-test/revenge.jpg
node:internal/modules/run_main:123
triggerUncaughtException(
^
[Error: ENOENT: no such file or directory, open 'E:\Projects\programs\iiif\my-collection\0-first-image-manifest\_revenge-test\info
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'E:\\Projects\\programs\\iiif\\my-collection\\0-first-image-manifest\\_revenge-test\\info.yml\\index.json'
}
Node.js v22.9.0What catches my eye is actually not the error, but the following lines of output:
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test/info.yml
...
creating directory for: ./my-collection/0-first-image-manifest/_revenge-test/revenge.jpg
Why are these files being recognized as directories?
Proposed solution
I was able to fix this problem by modifying the following line of code in my local installation to use path.join instead of string concatenation.
Current line:
Line 77 in 1677fc5
| const directoriesPattern: string = this.directoryFilePath + "/*"; |
Proposed change:
const directoriesPattern = path_1.join(this.directoryFilePath,"*");This solves the problem and causes glob_promise to properly ignore the .yml and .jpg files on my system.