1.3.2 preparations
This commit is contained in:
parent
14a18fd770
commit
3e50846135
17 changed files with 1929 additions and 1906 deletions
|
|
@ -11,45 +11,52 @@ import java.io.FileReader;
|
|||
|
||||
public class StorageConfigHelper
|
||||
{
|
||||
public static File getSecondarySegmentDir( String segmentDir )
|
||||
{
|
||||
return getStorageLocation( segmentDir, "secondary_segment_dir=" );
|
||||
}
|
||||
public static File getSecondarySegmentDir( String segmentDir )
|
||||
{
|
||||
return getStorageLocation( segmentDir, "secondary_segment_dir=" );
|
||||
}
|
||||
|
||||
public static File getAdditionalMaptoolDir( String segmentDir )
|
||||
{
|
||||
return getStorageLocation( segmentDir, "additional_maptool_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";
|
||||
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) { /* ignore */ }
|
||||
finally
|
||||
{
|
||||
if ( br != null )
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
}
|
||||
catch( Exception e ) {}
|
||||
finally
|
||||
{
|
||||
if ( br != null ) try { br.close(); } catch( Exception ee ) {}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
catch (Exception ee) { /* ignore */ }
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue