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

Minor bin/libs/fs.mkdirp update #4013

Merged
merged 3 commits into from
Sep 26, 2024
Merged

Conversation

Martin-Zeithaml
Copy link
Contributor

mkdirp is:

  • always expecting input
  • "Split loop" not working as expected, see test

Split loop test

function mkdirpOld(path) {
    let paths = [];
    let parts = path.split('/');
    let currentPath = '';
    parts.forEach((part)=> {
      currentPath+='/'+part;
      if (currentPath.startsWith('//')) {
        currentPath = currentPath.substring(1);
      }
      paths.push(currentPath);
    });
    console.log(paths);
}

function mkdirpNew(path) {
    let paths = [];
    let parts = path.split('/');
    let currentPath = '';
    parts.forEach((part)=> {
      if (part) {
        currentPath += '/' + part;
        paths.push(currentPath);
      }
    });
    console.log(paths);
}

mkdirpOld('/asdf/asdf////134////2435234524/////asdfasdfasd');

mkdirpNew('/asdf/asdf////134////2435234524/////asdfasdfasd');

Output

[
  '/',
  '/asdf',
  '/asdf/asdf',
  '/asdf/asdf/',
  '/asdf/asdf//',
  '/asdf/asdf///',
  '/asdf/asdf////134',
  '/asdf/asdf////134/',
  '/asdf/asdf////134//',
  '/asdf/asdf////134///',
  '/asdf/asdf////134////2435234524',
  '/asdf/asdf////134////2435234524/',
  '/asdf/asdf////134////2435234524//',
  '/asdf/asdf////134////2435234524///',
  '/asdf/asdf////134////2435234524////',
  '/asdf/asdf////134////2435234524/////asdfasdfasd'
]
[
  '/asdf',
  '/asdf/asdf',
  '/asdf/asdf/134',
  '/asdf/asdf/134/2435234524',
  '/asdf/asdf/134/2435234524/asdfasdfasd'
]

Signed-off-by: Martin Zeithaml <[email protected]>
Copy link

github-actions bot commented Sep 25, 2024

build 6152 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/11033763239

Copy link

github-actions bot commented Sep 25, 2024

Test workflow 5473 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.0.0-PR-4013/zowe-3.0.0-pr-4013-6152-20240925131904.pax
Running on machine: zzow08
Result: SUCCESS
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/11033900041

Copy link
Contributor

@JoeNemo JoeNemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Copy link

github-actions bot commented Sep 25, 2024

build 6160 SUCCEEDED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/11036360425

Copy link

github-actions bot commented Sep 25, 2024

Test workflow 5477 is started.
Running install test: Convenience Pax
The zowe artifact being used by this test workflow: libs-snapshot-local/org/zowe/3.0.0-PR-4013/zowe-3.0.0-pr-4013-6160-20240925154352.pax
Running on machine: zzow08
Result: SUCCESS
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/11036520437

@MarkAckert MarkAckert added the Build: None Used in CI label Sep 26, 2024
@MarkAckert MarkAckert merged commit 1c1176d into v3.x/staging Sep 26, 2024
7 of 8 checks passed
@MarkAckert MarkAckert deleted the v3.x/feature/mkdirp branch September 26, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build: None Used in CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants