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

tscoder is unable to create new directories #12

Open
c-u-l8er opened this issue Aug 17, 2024 · 1 comment · May be fixed by #18
Open

tscoder is unable to create new directories #12

c-u-l8er opened this issue Aug 17, 2024 · 1 comment · May be fixed by #18

Comments

@c-u-l8er
Copy link

Within "write each file" method I was able to add one line of code to get it working :)

  // Backup existing file if it exists
  if (await fs.access(absolutePath).then(() => true).catch(() => false)) {
    await fs.copyFile(absolutePath, backupPath);
  }
  
  // Create necessary directories for the target file
  await fs.mkdir(path.dirname(absolutePath), { recursive: true });
  
  // Write the new content
  await fs.writeFile(absolutePath, fileToWrite.content, 'utf-8');
@VictorTaelin
Copy link
Owner

ty @Lorenzobattistela can you have a look?

@Lorenzobattistela Lorenzobattistela linked a pull request Aug 30, 2024 that will close this issue
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 a pull request may close this issue.

2 participants