Skip to content

refactor: backslashes on Windows - #5457

Merged
stevenjoezhang merged 1 commit into
masterfrom
windows
Apr 9, 2024
Merged

refactor: backslashes on Windows#5457
stevenjoezhang merged 1 commit into
masterfrom
windows

Conversation

@stevenjoezhang

@stevenjoezhang stevenjoezhang commented Apr 8, 2024

Copy link
Copy Markdown
Member

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.

@github-actions

github-actions Bot commented Apr 8, 2024

Copy link
Copy Markdown

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
@stevenjoezhang
stevenjoezhang deleted the windows branch April 9, 2024 12:16
@stevenjoezhang

Copy link
Copy Markdown
Member Author

See also hexojs/hexo-util#230

stevenjoezhang added a commit that referenced this pull request Apr 29, 2024
stevenjoezhang added a commit that referenced this pull request May 21, 2024
dimaslanjaka referenced this pull request in dimaslanjaka/hexo Oct 3, 2024
dimaslanjaka referenced this pull request in dimaslanjaka/hexo Oct 3, 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.

2 participants