extended configuration (to hande Kitkat issues)
This commit is contained in:
parent
a6878ba04e
commit
631057cd5f
10 changed files with 251 additions and 40 deletions
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Access to the storageconfig.txt config file
|
||||
*
|
||||
* @author ab
|
||||
*/
|
||||
package btools.mapaccess;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
|
||||
public class StorageConfigHelper
|
||||
{
|
||||
public static File getSecondarySegmentDir( String segmentDir )
|
||||
{
|
||||
return getStorageLocation( segmentDir, "secondary_segment_dir=" );
|
||||
}
|
||||
|
||||
public static File getAdditionalMaptoolDir( String segmentDir )
|
||||
{
|
||||
return getStorageLocation( segmentDir, "additional_maptool_dir=" );
|
||||
}
|
||||
|
||||
private static File getStorageLocation( String segmentDir, String tag )
|
||||
{
|
||||
File res = null;
|
||||
BufferedReader br = null;
|
||||
String configFile = segmentDir + "/storageconfig.txt";
|
||||
try
|
||||
{
|
||||
br = new BufferedReader( new FileReader (configFile ) );
|
||||
for(;;)
|
||||
{
|
||||
String line = br.readLine();
|
||||
if ( line == null ) break;
|
||||
line = line.trim();
|
||||
if ( line.startsWith( "#") ) continue;
|
||||
if ( line.startsWith( tag ) )
|
||||
{
|
||||
String path = line.substring( tag.length() ).trim();
|
||||
res = path.startsWith( "/" ) ? new File( path ) : new File( new File( segmentDir ) , path );
|
||||
if ( !res.exists() ) res = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception e ) {}
|
||||
finally
|
||||
{
|
||||
if ( br != null ) try { br.close(); } catch( Exception ee ) {}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue