Skip to content

tscoder is unable to create new directories #12

Description

@c-u-l8er

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions