Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serving test data on windows #442

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

M393
Copy link
Contributor

@M393 M393 commented Oct 10, 2024

On windows the path was also prefixed with a slash like /C:\\geotiff.js\\test and then it tried to serve files from C:\\C:\\geotiff.js\\test

@constantinius
Copy link
Member

@M393 I fixed the missing file issue. Could you please update from master and try again?

@M393
Copy link
Contributor Author

M393 commented Oct 14, 2024

This issue is not related to the missing test image. No files at all were served on windows.

  • import.meta.url is e. g. 'file:///C:/geotiff.js/test/geotiff.spec.js'
  • new URL(import.meta.url).pathname becomes '/C:/geotiff.js/test/geotiff.spec.js',
    note the additional slash at the start,
  • serve-static uses resolve from the path module, which finally results in 'C:\\C:\\geotiff.js\\test'.

fileURLToPath is the platform-independent way of getting the file path.

@constantinius constantinius merged commit af0421b into geotiffjs:master Oct 15, 2024
1 check passed
@M393 M393 deleted the fix-test-on-windows branch October 15, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants