[go: up one dir, main page]

Menu

[337d9f]: / Perl / clean_models.pl  Maximize  Restore  History

Download this file

39 lines (31 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) 2013-2015 OpenM++
# This code is licensed under MIT license (see LICENSE.txt for details)
# Script to clean all temporary and output files in ompp, ompp-linux, and modgen
# usage: perl clean_models.pl models
# If models is not specified, all models will be processed.
chdir "../models" || die "Invoke test_models from Perl folder";
use File::Path qw(make_path remove_tree);
my @model_dirs;
if ($#ARGV >= 0) {
# model folders listed explicitly on command line
@model_dirs = @ARGV;
}
else {
# no models listed on command line
# Create model list by identifying all model subdirectories
my @paths = glob "*/code";
for my $path (@paths) {
$path =~ s/\/.*//;
push @model_dirs, $path;
}
}
for my $model_dir (@model_dirs) {
print "Cleaning ${model_dir}\n";
for my $subdir ("src", "build", "bin") {
my @temp_dirs = glob("${model_dir}/*/${subdir}");
for my $temp_dir (@temp_dirs) {
print " removing ${temp_dir}\n";
remove_tree $temp_dir;
}
}
}