diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index e897889..7c164cd 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -268,20 +268,23 @@ public class BRouterView extends View // add a "last timeout" dummy profile File lastTimeoutFile = new File( modesDir + "/timeoutdata.txt" ); long lastTimeoutTime = lastTimeoutFile.lastModified(); - if ( lastTimeoutTime > 0 && System.currentTimeMillis() - lastTimeoutTime < 300000 ) + if ( lastTimeoutTime > 0 && System.currentTimeMillis() - lastTimeoutTime < 1800000 ) { - profiles.add( 0, "" ); + BufferedReader br = new BufferedReader( new FileReader( lastTimeoutFile ) ); + String repeatProfile = br.readLine(); + br.close(); + profiles.add( 0, "" ); } if ( !lookupsFound ) { throw new IllegalArgumentException( "The profile-directory " + profileDir + " does not contain the lookups.dat file." - + " see www.dr-brenschede.de/brouter for setup instructions." ); + + " see brouter.de/brouter for setup instructions." ); } if ( profiles.size() == 0 ) { throw new IllegalArgumentException( "The profile-directory " + profileDir + " contains no routing profiles (*.brf)." - + " see www.dr-brenschede.de/brouter for setup instructions." ); + + " see brouter.de/brouter for setup instructions." ); } if ( !RoutingHelper.hasDirectoryAnyDatafiles( segmentDir ) ) { @@ -431,7 +434,7 @@ public class BRouterView extends View public void startProcessing( String profile ) { rawTrackPath = null; - if ( "".equals( profile ) ) + if ( profile.startsWith( " getStorageDirectories() { ArrayList res = new ArrayList(); + + // check write access on internal sd + try + { + File sd = Environment.getExternalStorageDirectory(); + File testDir = new File( sd, "brouter" ); + boolean didExist = testDir.isDirectory(); + if ( !didExist ) + { + testDir.mkdir(); + } + File testFile = new File( testDir, "test" + System.currentTimeMillis() ); + testFile.createNewFile(); + if ( testFile.exists() ) + { + testFile.delete(); + res.add( sd.getPath() ); + } + if ( !didExist ) + { + testDir.delete(); + } + } + catch( Throwable t ) + { + // ignore + } + try { diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java index cfd5d4c..1dc7eb4 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java @@ -72,6 +72,12 @@ public class BRouterWorker waypoints = readPositions(params); + try + { + writeTimeoutData( rc ); + } + catch( Exception e ) {} + RoutingEngine cr = new RoutingEngine( null, null, segmentDir, waypoints, rc ); cr.quite = true; cr.doRun( maxRunningTime ); @@ -89,14 +95,6 @@ public class BRouterWorker if ( cr.getErrorMessage() != null ) { - if ( cr.getErrorMessage().indexOf( "timeout" ) >= 0 ) - { - try - { - writeTimeoutData( rc ); - } - catch( Exception e ) {} - } return cr.getErrorMessage(); }