Index: potx-cli.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx-cli.php,v
retrieving revision 1.1.2.6.4.4.2.2
diff -u -p -r1.1.2.6.4.4.2.2 potx-cli.php
--- potx-cli.php	23 Aug 2009 10:27:42 -0000	1.1.2.6.4.4.2.2
+++ potx-cli.php	25 Aug 2009 15:47:04 -0000
@@ -82,14 +82,14 @@ END;
       $files = array(__FILE__);
       break;
     case '--auto' :
-      $files = _potx_explore_dir();
+      $files = _potx_explore_dir('', '*', POTX_API_CURRENT, TRUE);
       break;
   }
 }
 
 // Fall back to --auto, if --files are not specified
 if (empty($files)) {
-  $files = _potx_explore_dir();
+  $files = _potx_explore_dir('', '*', POTX_API_CURRENT, TRUE);
 }
 
 foreach ($files as $file) {
Index: potx.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx.inc,v
retrieving revision 1.1.2.17.2.7.2.19.2.7
diff -u -p -r1.1.2.17.2.7.2.19.2.7 potx.inc
--- potx.inc	25 Aug 2009 15:36:01 -0000	1.1.2.17.2.7.2.19.2.7
+++ potx.inc	25 Aug 2009 15:47:04 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: potx.inc,v 1.1.2.17.2.7.2.19.2.7 2009/08/25 15:36:01 goba Exp $
+// $Id: potx.inc,v 1.1.2.17.2.7.2.19.2.6 2009/08/24 07:36:39 goba Exp $
 
 /**
  * @file
@@ -1384,10 +1384,12 @@ function _potx_parse_js_string($string) 
  *   (ie. to collect files for a specific module).
  * @param $api_version
  *   Drupal API version to work with.
- * @todo
- *   Add folder exceptions for other version control systems.
+ * @param $skip_self
+ *   Skip potx related files. To be used when command line type of extraction
+ *   is used and the potx files at in the webroot, and their strings should not
+ *   end up in the generated template. Set to TRUE if skiping is needed.
  */
-function _potx_explore_dir($path = '', $basename = '*', $api_version = POTX_API_CURRENT) {
+function _potx_explore_dir($path = '', $basename = '*', $api_version = POTX_API_CURRENT, $skip_self = FALSE) {
   // It would be so nice to just use GLOB_BRACE, but it is not available on all
   // operarting systems, so we are working around the missing functionality.
   $extensions = array('php', 'inc', 'module', 'engine', 'theme', 'install', 'info', 'profile');
@@ -1419,12 +1421,11 @@ function _potx_explore_dir($path = '', $
       }
     }
   }
-  // Skip our own files, because we don't want to get strings from them
-  // to appear in the output, especially with the command line interface.
-  // Also exclude API files from being parsed.
-  // TODO: fix this to be able to autogenerate templates for potx itself.
+
+  // Skip API files. Also skip our own files, if that was requested.
+  $skip_pattern = ($skip_self ? '!(potx-cli\.php|potx\.inc|\.api\.php)$!' : '!\.api\.php$!');
   foreach ($files as $id => $file_name) {
-    if (preg_match('!(potx-cli\.php|potx\.inc|\.api\.php)$!', $file_name)) {
+    if (preg_match($skip_pattern, $file_name)) {
       unset($files[$id]);
     }
   }
