Skip to content

Instantly share code, notes, and snippets.

@triplefox
Created July 9, 2017 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triplefox/eba29cc7eeff1617ae319743fe6b727e to your computer and use it in GitHub Desktop.
Save triplefox/eba29cc7eeff1617ae319743fe6b727e to your computer and use it in GitHub Desktop.
# initialize a new allegro-pascal project
my $projectname = "newproject";
my $allegropas-src = "allegro.pas-5.2.a3-src-pas/lib";
if $projectname.IO.e {
say "project $projectname already exists";
} else {
mkdir $projectname or die "$!";
try {
CATCH {
rmdir $projectname;
die "$_!";
}
my @filelist = dir $allegropas-src;
for @filelist {
my $relpath = $_.relative($allegropas-src);
copy $_, $projectname.IO.add($relpath);
}
say "created project $projectname";
}
}
@b2gills
Copy link

b2gills commented Jul 9, 2017

There is no need for or die "$!" as that is what happens when mkdir is in sink context.

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