|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: Copy all cpcfg files to destination directory when building control panel in window envionment |
|
15 # usage: go to control panel source directory, |
|
16 # run cpcfg_win.pl if you want to build control panel in debug mode or cpcfg_win -R in release mode. |
|
17 |
|
18 use File::Path qw (mkpath); |
|
19 |
|
20 #default debug dir |
|
21 $config_dir = "C:\\ControlPanel\\debug\\bin\\config"; |
|
22 if ($ARGV[0] =~ m/^-R$/i) { #release dir |
|
23 $config_dir = "C:\\ControlPanel\\release\\bin\\config"; |
|
24 } |
|
25 |
|
26 sub go_through_dir { |
|
27 my @arr, $j = 0; |
|
28 for ($i=0;$i<=$#_;$i++) { |
|
29 if (-d $_[$i]) { |
|
30 if (opendir($handle, $_[$i])) { |
|
31 while ($entry = readdir($handle)) { |
|
32 if (!($entry =~ m/^\.$/) and !($entry =~ m/^(\.\.)$/)) { |
|
33 if (-d $_[$i]."\\$entry") { # is a directory, push to @arr |
|
34 $arr[$j++] = $_[$i]."\\$entry"; |
|
35 } |
|
36 else { # is a file |
|
37 if ($entry =~ m/\.cpcfg$/i) { # is a .cpcfg file, copy it |
|
38 $cmd = "copy "; |
|
39 $cmd .= $_[$i]."\\$entry "; |
|
40 $cmd .= $config_dir."\\$entry"; |
|
41 print ("$cmd\n"); |
|
42 system($cmd); |
|
43 } |
|
44 } |
|
45 } |
|
46 } |
|
47 closedir($handle); |
|
48 } |
|
49 } |
|
50 } |
|
51 if ($j>0) { |
|
52 go_through_dir (@arr); |
|
53 } |
|
54 } |
|
55 |
|
56 # create target directory if it doesn't exist |
|
57 print ("Creating direcotry... $config_dir \n"); |
|
58 mkpath $config_dir; |
|
59 |
|
60 # go through source directories recrusively |
|
61 go_through_dir ".\\src\\cpapplication",".\\src\\cpplugins"; |