AI-scripts icon indicating copy to clipboard operation
AI-scripts copied to clipboard

tscoder is unable to create new directories

Open c-u-l8er opened this issue 1 year ago • 1 comments

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');

c-u-l8er avatar Aug 17 '24 01:08 c-u-l8er

ty @Lorenzobattistela can you have a look?

VictorTaelin avatar Aug 30 '24 12:08 VictorTaelin