4567df2001-07-20Martin Nilsson string copy_to = "manual/images";
8ed7eb2001-07-18Martin Nilsson void parse_directory(string directory) { werror("autodoc_images: Entering %s...\n", directory); array(string) files = get_dir(directory); foreach(files, string file) { // werror("%O\n", directory+file); if(file_stat(directory+file)->isdir) { parse_directory(directory+file+"/"); continue; } if(!has_suffix(file, ".xml")) continue; if(file=="sub_manual.xml") continue;
20a38f2001-07-26Martin Nilsson  string x,y; y = Stdio.read_file(directory+file);
4567df2001-07-20Martin Nilsson #ifdef DEBUG array err = catch { x = Tools.AutoDoc.ProcessXML.moveImages
20a38f2001-07-26Martin Nilsson  (y, directory, copy_to);
4567df2001-07-20Martin Nilsson  };
20a38f2001-07-26Martin Nilsson  if(!err) { if(x!=y) Stdio.write_file(directory+file, x); }
4567df2001-07-20Martin Nilsson  else werror(describe_backtrace(err)); #else x = Tools.AutoDoc.ProcessXML.moveImages (Stdio.read_file(directory+file), directory, copy_to);
20a38f2001-07-26Martin Nilsson  if(x!=y) Stdio.write_file(directory+file, x);
4567df2001-07-20Martin Nilsson #endif
8ed7eb2001-07-18Martin Nilsson  } } int main(int num, array(string) args) {
4567df2001-07-20Martin Nilsson  if(num<3) throw( "Not enough arguments to autodoc_images.pike\n" ); copy_to = args[2];
8ed7eb2001-07-18Martin Nilsson  parse_directory( args[1] ); }