Skip to content

fix: correct absolute path creation in create-tool script - #370

Open
Devendra8839 wants to merge 1 commit into
iib0011:mainfrom
Devendra8839:fix/create-tool-path-bug
Open

fix: correct absolute path creation in create-tool script #370
Devendra8839 wants to merge 1 commit into
iib0011:mainfrom
Devendra8839:fix/create-tool-path-bug

Conversation

@Devendra8839

Copy link
Copy Markdown

Description

This PR fixes an issue in the create-tool scaffold script where tool generation failed on Unix-based systems due to incorrect absolute path handling.

Problem

Running the scaffold generator command resulted in partially created directories followed by an ENOENT error during file creation.

Example failure:

Error: ENOENT: no such file or directory

The issue occurred because recursive directory creation was initialized using a relative root (.) even when processing absolute paths.

As a result, directories were incorrectly generated as relative paths such as:

home/user/project/...

instead of the expected absolute paths:

/home/user/project/...

This caused subsequent scaffold files (such as index.tsx) to fail during creation because the target absolute directory structure did not actually exist.

Root Cause

Inside createFolderStructure(), recursive folder creation was initialized with:

recursiveCreate('.', 0);

Using . as the starting base path caused absolute path segments to be resolved relative to the current working directory during recursive joins.

Fix

The recursive creation process now starts from the filesystem root using:

recursiveCreate(sep, 0);

This ensures absolute paths are preserved correctly during recursive directory creation and allows the scaffold generator to successfully create all required files and directories on Unix-based systems.

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.

1 participant