controlpanelui/cpcfg_win.pl
changeset 10 0a74be98a8bc
child 11 10d0dd0e43f1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/cpcfg_win.pl	Fri Mar 19 09:29:29 2010 +0200
@@ -0,0 +1,49 @@
+
+# description: copy all cpcfg files to destination directory when building control panel in window envionment
+# usage: go to control panel source directory, 
+# run cpcfg_win.pl if you want to build control panel in debug mode or cpcfg_win -R in release mode.
+
+use File::Path qw (mkpath);
+
+#default debug dir
+$config_dir = "C:\\ControlPanel\\debug\\bin\\config";
+if ($ARGV[0] =~ m/^-R$/i) { #release dir
+	$config_dir = "C:\\ControlPanel\\release\\bin\\config";
+} 
+
+sub go_through_dir {  
+ my @arr, $j = 0;  
+ for ($i=0;$i<=$#_;$i++) {  
+  if (-d $_[$i]) {  
+   if (opendir($handle, $_[$i])) {  
+    while ($entry = readdir($handle)) {  
+     if (!($entry =~ m/^\.$/) and !($entry =~ m/^(\.\.)$/)) {   
+      if (-d $_[$i]."\\$entry") {  # is a directory, push to @arr
+       $arr[$j++] = $_[$i]."\\$entry";   
+      }  
+      else {   # is a file
+      	if ($entry =~ m/\.cpcfg$/i) { # is a .cpcfg file, copy it
+      		$cmd = "copy ";
+      		$cmd .= $_[$i]."\\$entry ";
+      		$cmd .= $config_dir."\\$entry";
+      		print ("$cmd\n");
+      		system($cmd);
+      	}
+      }
+     }  
+    }  
+    closedir($handle);  
+   }  
+  }  
+ }  
+ if ($j>0) {  
+  go_through_dir (@arr);  
+ }  
+}
+
+# create target directory if it doesn't exist
+print ("Creating direcotry... $config_dir \n");
+mkpath $config_dir;
+
+# go through source directories recrusively
+go_through_dir ".\\src\\cpapplication",".\\src\\cpplugins";
\ No newline at end of file