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

refactor: backslashes on Windows #5457

Merged
merged 1 commit into from Apr 9, 2024
Merged

refactor: backslashes on Windows #5457

merged 1 commit into from Apr 9, 2024

Conversation

stevenjoezhang
Copy link
Member

@stevenjoezhang stevenjoezhang commented Apr 8, 2024

What does it do?

I have noticed that currently on Windows, paths in Hexo are converted frequently. For example, when adding files to the ctx.model('Cache') database, the path separators \ are replaced with /, and later when Assets use these paths, the join function is called, which on Windows, will replace / back with \. This pull request aims to standardize the separator in the cache's _id to match the current operating system's support and to avoid using hardcoded separators (using path.sep instead). It will not change existing functionalities but is intended to improve the uniformity and maintainability of the code.

WIP: pending #5385

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

Copy link

github-actions bot commented Apr 8, 2024

How to test

git clone -b windows https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

@stevenjoezhang stevenjoezhang marked this pull request as ready for review April 9, 2024 08:07
@stevenjoezhang stevenjoezhang requested a review from a team April 9, 2024 08:07
@stevenjoezhang stevenjoezhang merged commit 80dafe2 into master Apr 9, 2024
28 of 29 checks passed
@stevenjoezhang stevenjoezhang deleted the windows branch April 9, 2024 12:16
@stevenjoezhang
Copy link
Member Author

See also hexojs/hexo-util#230

stevenjoezhang added a commit that referenced this pull request Apr 26, 2024
stevenjoezhang added a commit that referenced this pull request Apr 29, 2024
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.

None yet

2 participants