Cleanup base directory selection, use Context.getExternalFilesDirs and request WRITE_EXTERNAL_STORAGE permission, use AndroidX and raise minSdkVersion to 14. Use File instead of plain Strings for paths in some places, use try-with-resources, and some other small improvements.

This commit is contained in:
Niklas Guertler 2020-05-24 17:49:50 +02:00
parent 72e2e13d07
commit dbdfd36f88
17 changed files with 173 additions and 220 deletions

View file

@ -56,10 +56,10 @@ public final class NodesCache
return "collecting=" + garbageCollectionEnabled + " noGhosts=" + ghostCleaningDone + " cacheSum=" + cacheSum + " cacheSumClean=" + cacheSumClean + " ghostSum=" + ghostSum + " ghostWakeup=" + ghostWakeup ;
}
public NodesCache( String segmentDir, BExpressionContextWay ctxWay, boolean forceSecondaryData, long maxmem, NodesCache oldCache, boolean detailed )
public NodesCache( File segmentDir, BExpressionContextWay ctxWay, boolean forceSecondaryData, long maxmem, NodesCache oldCache, boolean detailed )
{
this.maxmemtiles = maxmem / 8;
this.segmentDir = new File( segmentDir );
this.segmentDir = segmentDir;
this.nodesMap = new OsmNodesMap();
this.nodesMap.maxmem = (2L*maxmem) / 3L;
this.expCtxWay = ctxWay;
@ -77,7 +77,7 @@ public final class NodesCache
first_file_access_name = null;
if ( !this.segmentDir.isDirectory() )
throw new RuntimeException( "segment directory " + segmentDir + " does not exist" );
throw new RuntimeException( "segment directory " + segmentDir.getAbsolutePath () + " does not exist" );
if ( oldCache != null )
{