Fix:maptool:Made -b option work
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 11 Jul 2011 09:34:48 +0000 (09:34 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 11 Jul 2011 09:34:48 +0000 (09:34 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4622 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/maptool/maptool.c

index 622d78c..e00a482 100644 (file)
@@ -804,7 +804,7 @@ int main(int argc, char **argv)
                p.node_table_loaded=0;
        } else {
                fprintf(stderr,"PROGRESS: Phase %d: Reading data\n",phase);
-               FILE *ways_split=tempfile(suffix,"ways_split",0);
+               FILE *ways_split=tempfile(suffix,"ways_split",1);
                process_binfile(stdin, ways_split);
                fclose(ways_split);
                phase++;
@@ -817,19 +817,22 @@ int main(int argc, char **argv)
        phase++;
        if (p.start <= phase && p.end >= phase) {
                FILE *towns=tempfile(suffix,"towns",0),*boundaries=NULL,*ways=NULL;
-               if (experimental) {
-                       boundaries=tempfile(suffix,"boundaries",0);
-                       ways=tempfile(suffix,"ways_split",0);
-               }
-               fprintf(stderr,"PROGRESS: Phase %d: assinging towns to countries\n",phase);
-               osm_process_towns(towns,boundaries,ways);
-               if (experimental) {
-                       fclose(ways);
-                       fclose(boundaries);
-               }
-               fclose(towns);
-               if(!p.keep_tmpfiles)
-                       tempfile_unlink(suffix,"towns");
+               if (towns) {
+                       if (experimental) {
+                               boundaries=tempfile(suffix,"boundaries",0);
+                               ways=tempfile(suffix,"ways_split",0);
+                       }
+                       fprintf(stderr,"PROGRESS: Phase %d: assinging towns to countries\n",phase);
+                       osm_process_towns(towns,boundaries,ways);
+                       if (experimental) {
+                               fclose(ways);
+                               fclose(boundaries);
+                       }
+                       fclose(towns);
+                       if(!p.keep_tmpfiles)
+                               tempfile_unlink(suffix,"towns");
+               } else
+                       fprintf(stderr,"PROGRESS: Phase %d: skipped, towns file not found\n",phase);
        }
        phase++;
        if (p.start <= phase && p.end >= phase) {