Skip to content

Commit

Permalink
fix: PathNotFoundException when using templates (#98)
Browse files Browse the repository at this point in the history
* fix: PathNotFoundException when using templates

* log commands

---------

Co-authored-by: Chima Precious <[email protected]>
  • Loading branch information
exaby73 and codekeyz authored Jul 10, 2024
1 parent 0b65bc4 commit a4d5e8f
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ class CreateProjectFromTemplate extends BaseGlobeCommand {
List<String> args, {
String? processWorkingDir,
}) async {
final command = 'git ${args.join(' ')}';

var info = 'Executing command: $command';
if (processWorkingDir != null) info += ' in dir: $processWorkingDir';
logger.detail(info);

final result = await Process.run(
'git',
args,
Expand Down Expand Up @@ -81,6 +87,9 @@ class CreateProjectFromTemplate extends BaseGlobeCommand {
final sparseCheckoutFile = File(
p.join(directory.path, '.git', 'info', 'sparse-checkout'),
);
if (!sparseCheckoutFile.existsSync()) {
sparseCheckoutFile.createSync(recursive: true);
}
sparseCheckoutFile.writeAsStringSync('templates/$template/');

// Pull the specific branch or commit
Expand Down

0 comments on commit a4d5e8f

Please sign in to comment.