Skip to content

Conversation

@DemetriSam
Copy link

@DemetriSam DemetriSam commented Aug 4, 2025

Fixes #235
The issue stems from the createFolderStructure function using recursiveCreate('.', 0), which causes all folder paths to be resolved relative to process.cwd().

As a result, calling .split(sep) on an absolute path and feeding it to recursiveCreate('.', ...) leads to the full absolute path being recreated inside the current directory, e.g.:

$PWD/home/user/...

Suggested Fix
Before passing toolDir to createFolderStructure(...), normalize it to be relative to the current working directory, e.g.:

import { relative } from 'path';

createFolderStructure(relative('.', toolDir), folder.split(sep).length);

This allows the function to create directories in the correct location relative to the actual working directory.

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.

[Unexpected behaviour] create-tool.mjs creates folder in incorrect location

1 participant