Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_mover/contrib/mm_antiword/Attic/README.txt,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 README.txt
--- README.txt	1 Mar 2009 17:18:16 -0000	1.1.2.2
+++ README.txt	4 Jun 2009 03:01:53 -0000
@@ -18,6 +18,8 @@ also download the binary from the antiwo
 
 http://www.winfield.demon.nl/
 
+Once you have antiword installed...
+
 Copy the module into your sites modules directory or into the all/modules
 directory
 
@@ -29,9 +31,62 @@ will need to set it by hand:
 Go to admin > build > media mover > settings and set the path to the
 binary file for antiword (where you installed it).
 
-Got to admin > build > media mover and create a new configuration using antiword
+Go to admin > build > media mover and create a new configuration using antiword
 
+Shared Hosting Installation
+--------------------------------------
+Your mileage may vary here of course.  It may be possible to install antiword
+on shared hosting, but you'll need to get secure shell (ssh) access and be 
+comfortable using the command line.
+
+Try these steps (at a secure shell on your web server)...
+NOTE: In the below steps $HOME is your home directory on your server which
+you can discover yourself by entering "env" (without the quotes) at a command line and looking for
+HOME=... in the results.
+
+1. From the Antiword home page (http://www.winfield.demon.nl/), find the
+   link to download the "developers version"
+2. Follow these steps to install it...
+(a) Make a suitable directory such as '$HOME/src/antiword' and copy the 
+'antiword.tar.gz' file to this directory.
+(b) decompress: 'gunzip antiword.tar.gz'
+(c) unpack: 'tar xvf antiword.tar'
+(d) compile: 'make all'
+(e) install: 'make install'. This will install Antiword in the $HOME/bin directory.
+(f) copy the file 'fontnames' and one or more mapping files from the Resources 
+directory to the $HOME/.antiword directory (note the dot before antiword!).
+NOTE: you can skip point (f) if your system administrator already copied these 
+files to /usr/share/antiword.
+
+Important.  Since you will not have installed antiword as a "superuser" you
+will most likely have to set the path to the antiword mapping files manually
+on the admin/settings/media_mover screen to avoid having output files of 0 size.
+The path to your mapping files should be $HOME/.antiword if you followed the 
+above instructions.  But remember, you'll need to use the full path when
+providing this setting.
+
+See Troubleshooting below for details.
+
+Troubleshooting
+--------------------------------------
+Antiword uses mapping files for various charactersets (MacRoman, UTF-8, etc.).
+When run from the command line it is usually able to find these files.
+However, when run from as the apache user (through drupal php for example), 
+Antiword may not be able to find these files.
+
+A symptom of this problem would be that files are created of 0 size.
+
+Resolution: After installing Antiword on your server determine the location of
+the mapping files (a common location might be $HOME/.antiword).  Once you find
+them get the full directory path and set it manually in the media mover admin
+settings for mm_antiword.  To get the full server path...
 
-For more information on Antiword, please see: http://www.winfield.demon.nl/
+ - Navigate to the $HOME/.antiword folder from the command line
+ - Enter the "pwd" command to print the present working directory
 
+In Drupal, go to admin/settings/media_mover and make sure to enter this path
+in the appropriate spot.
 
+More Information
+--------------------------------------
+For more information on Antiword, please see: http://www.winfield.demon.nl/
Index: mm_antiword.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_mover/contrib/mm_antiword/Attic/mm_antiword.module,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 mm_antiword.module
--- mm_antiword.module	1 Mar 2009 17:18:16 -0000	1.1.2.2
+++ mm_antiword.module	4 Jun 2009 03:01:53 -0000
@@ -95,8 +95,14 @@ function mm_antiword_admin() {
     '#title' => t('Path to Antiword binary'),
     '#type' => 'textfield',
     '#default_value' => variable_get('mm_antiword_path', '/usr/bin/antiword'),
-    '#descript' => t('Path to the Antiword binary. You can find it by using the command line and typing "which antiword"'),
+    '#description' => t('Path to the Antiword binary. You can find it by using the command line and typing "which antiword"'),
   );
+  $form['mm_antiword']['mm_antiword_mapping_path'] = array(
+    '#title' => t('Path to Antiword mapping files'),
+    '#type' => 'textfield', 
+    '#default_value' => variable_get('mm_antiword_mapping_path', ''), 
+    '#description' => t('Path to the Antiword mapping files. If your output files are coming up empty, you may need to enter the full path to your Antiword mapping files. See README.txt document at media_mover/contrib/mm_antiword for more information on this setting.'),
+    );
 
   return $form;
 }
@@ -116,9 +122,23 @@ function mm_antiword_process($file, $con
     watchdog('MM Antiword', 'Path to anitword binary was not found', null, WATCHDOG_ERROR);
     return;
   }
-  // get the path to Zip
+  // get the path to Antiword executable
   $path_to_antiword = variable_get('mm_antiword_path', '/usr/bin/antiword');
 
+  // Was an Antiword mapping path specified in admin/settings/media_mover?
+  $mappingpath = variable_get('mm_antiword_mapping_path','');
+  if ($mappingpath) {
+    $mappingpath = (substr($mappingpath, -1) == '/') ? $mappingpath = substr($mappingpath, 0, -1) : $mappingpath;
+  }
+  // If the mapping path is valid, put it in ANTIWORDHOME environment variable so Antiword will find it
+  // Otherwise, log a watchdog error about the bad mapping path
+  if (file_exists($mappingpath. '/fontnames')) {
+    putenv('ANTIWORDHOME='. $mappingpath);
+  }
+  else {
+    watchdog('MM Antiword', 'Path to anitword mapping files was not valid', null, WATCHDOG_ERROR);
+  }
+
   // get the path to the file to operate on. We need this
   // to pass out of the function
   $file_path = media_mover_api_config_current_file($file);
@@ -130,6 +150,7 @@ function mm_antiword_process($file, $con
   $command = array(
     $path_to_antiword,
     '-m '. $configuration['mm_antiword_output_char_type'],
+    '-i 0',
     mm_antiword_output_configuration($configuration),
     escapeshellarg($file_path),
     '>',
@@ -166,4 +187,4 @@ function mm_antiword_output_configuratio
     break;
   }
   return $configuration;
-}
\ No newline at end of file
+}
