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

Use path.join instead of string interpolation #1052

Merged
merged 1 commit into from
Feb 22, 2020

Conversation

alyip98
Copy link
Contributor

@alyip98 alyip98 commented Feb 21, 2020

Assuming forward slashes may cause errors on windows systems

What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [x] Bug fix

What is the rationale for this request?
This line was causing a error in tests as createDir uses string splitting based on the path.sep native to the OS.

function createDir(pathArg) {
  const { dir, ext } = path.parse(pathArg);
  const dirNames = (ext === '')
    ? pathArg.split(path.sep)
    : dir.split(pathArg.sep);

What changes did you make? (Give an overview)
Changed a path concatenation to use path.join instead of string interpolation.

It was the only instance I could find in the entire project that was using string interpolation.

Provide some example code that this change will affect:
Should not have any changes

Is there anything you'd like reviewers to focus on?

Testing instructions:

Proposed commit message: (wrap lines at 72 characters)
Assuming forward slashes may cause errors on windows systems.
Let's use path.join to maintain cross platform compatibility.

Assuming forward slashes may cause errors on windows systems
@openorclose
Copy link
Contributor

LGTM 🚀

@alyip98 alyip98 requested a review from yamgent February 22, 2020 01:37
@yamgent yamgent merged commit de991ba into MarkBind:master Feb 22, 2020
@yamgent yamgent added this to the v2.10.1 milestone Feb 22, 2020
@alyip98 alyip98 deleted the avoid-path-string-concat branch February 22, 2020 04:37
Tejas2805 added a commit to Tejas2805/markbind that referenced this pull request Feb 27, 2020
* 'master' of https://github.com/MarkBind/markbind:
  Update tests
  Allow using 'none' footer attribute in frontmatter (MarkBind#1002)
  Support line numbers for code blocks (MarkBind#991)
  2.11.0
  Update test files due to changes in PR MarkBind#982
  Update vue-strap version to v2.0.1-markbind.36
  Make highlighting bold (MarkBind#1045)
  Support markdown for header attr in dropdown (MarkBind#1029)
  Add '_site' to the ignored folders in site.json (MarkBind#1046)
  Use path.join instead of string interpolation (MarkBind#1052)
  Implement box markdown header attributes parsing (MarkBind#1025)
  Make the position of top navbar fixed (MarkBind#982)
  Exclude *.md files from being copied over on build (MarkBind#1010)

# Conflicts:
#	docs/css/main.css
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.

3 participants