revertAllProcesses static method

void revertAllProcesses({
  1. required Directory initialDirectory,
  2. required String projectName,
})

Attempts to remove the created workspace folder when reverting.

Parameters:

  • initialDirectory: the directory that was current before scaffolding.
  • projectName: the base project name used to determine the workspace folder.

Throws:

  • Exception with message ⚠️ Failed to revert workspace processes on failure.

Implementation

static void revertAllProcesses({
  required Directory initialDirectory,
  required String projectName,
}) {
  try {
    Process.runSync(
      'rm',
      ['-rf', '${projectName}_workspaces'],
      workingDirectory: initialDirectory.path,
      runInShell: true,
    );
  } catch (_) {
    throw Exception('⚠️ Failed to revert workspace processes');
  }
}