Reformat files using Android Studio
android-studio/bin/format.sh -m '*.java' -r brouter-routing-app
To rebase active branches on top of the new master just rebase your
branch onto the commit prior to the reformatting and format every commit
of your branch using (<commit> should be replaced by this commit)
git rebase \
--strategy-option=theirs \
--onto <commit> \
--exec 'format.sh -m "*.java" -r brouter-routing-app' \
--exec 'git commit --all --no-edit --amend' \
<commit>~
To ignore this mass edit during git blame see `.git-blame-ignore-revs`
This commit is contained in:
parent
13e0e382c1
commit
54d5c5e943
18 changed files with 3025 additions and 3662 deletions
|
|
@ -8,136 +8,101 @@ import java.io.FileWriter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigMigration
|
||||
{
|
||||
public static void tryMigrateStorageConfig( File srcFile, File dstFile )
|
||||
{
|
||||
if ( !srcFile.exists() ) return;
|
||||
|
||||
public class ConfigMigration {
|
||||
public static void tryMigrateStorageConfig(File srcFile, File dstFile) {
|
||||
if (!srcFile.exists()) return;
|
||||
|
||||
String ssd = null;
|
||||
String amd = null;
|
||||
|
||||
BufferedReader br = null;
|
||||
BufferedWriter bw = null;
|
||||
try
|
||||
{
|
||||
br = new BufferedReader( new FileReader( srcFile ) );
|
||||
for ( ;; )
|
||||
{
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(srcFile));
|
||||
for (; ; ) {
|
||||
String line = br.readLine();
|
||||
if ( line == null ) break;
|
||||
if ( line.trim().startsWith( "secondary_segment_dir=" ) )
|
||||
{
|
||||
if ( !"secondary_segment_dir=../segments2".equals( line ) )
|
||||
{
|
||||
if (line == null) break;
|
||||
if (line.trim().startsWith("secondary_segment_dir=")) {
|
||||
if (!"secondary_segment_dir=../segments2".equals(line)) {
|
||||
ssd = line;
|
||||
}
|
||||
}
|
||||
if ( line.trim().startsWith( "additional_maptool_dir=" ) )
|
||||
{
|
||||
if (line.trim().startsWith("additional_maptool_dir=")) {
|
||||
amd = line;
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
|
||||
List<String> lines = new ArrayList<String>();
|
||||
br = new BufferedReader( new FileReader( dstFile ) );
|
||||
for ( ;; )
|
||||
{
|
||||
br = new BufferedReader(new FileReader(dstFile));
|
||||
for (; ; ) {
|
||||
String line = br.readLine();
|
||||
if ( line == null ) break;
|
||||
if ( ssd != null && line.trim().startsWith( "secondary_segment_dir=" ) )
|
||||
{
|
||||
if (line == null) break;
|
||||
if (ssd != null && line.trim().startsWith("secondary_segment_dir=")) {
|
||||
line = ssd;
|
||||
}
|
||||
if ( amd != null && line.trim().startsWith( "#additional_maptool_dir=" ) )
|
||||
{
|
||||
if (amd != null && line.trim().startsWith("#additional_maptool_dir=")) {
|
||||
line = amd;
|
||||
}
|
||||
lines.add( line );
|
||||
lines.add(line);
|
||||
}
|
||||
br.close();
|
||||
br = null;
|
||||
|
||||
bw = new BufferedWriter( new FileWriter( dstFile ) );
|
||||
for( String line: lines )
|
||||
{
|
||||
bw.write( line + "\n" );
|
||||
}
|
||||
}
|
||||
catch (Exception e) { /* ignore */ }
|
||||
finally
|
||||
{
|
||||
if ( br != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
bw = new BufferedWriter(new FileWriter(dstFile));
|
||||
for (String line : lines) {
|
||||
bw.write(line + "\n");
|
||||
}
|
||||
} catch (Exception e) { /* ignore */ } finally {
|
||||
if (br != null) {
|
||||
try {
|
||||
br.close();
|
||||
}
|
||||
catch (Exception ee) { /* ignore */ }
|
||||
} catch (Exception ee) { /* ignore */ }
|
||||
}
|
||||
if ( bw != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
if (bw != null) {
|
||||
try {
|
||||
bw.close();
|
||||
}
|
||||
catch (Exception ee) { /* ignore */ }
|
||||
} catch (Exception ee) { /* ignore */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static File saveAdditionalMaptoolDir( File segmentDir, String value )
|
||||
{
|
||||
return saveStorageLocation( segmentDir, "additional_maptool_dir=", value );
|
||||
public static File saveAdditionalMaptoolDir(File segmentDir, String value) {
|
||||
return saveStorageLocation(segmentDir, "additional_maptool_dir=", value);
|
||||
}
|
||||
|
||||
private static File saveStorageLocation( File segmentDir, String tag, String value )
|
||||
{
|
||||
private static File saveStorageLocation(File segmentDir, String tag, String value) {
|
||||
File res = null;
|
||||
BufferedReader br = null;
|
||||
BufferedWriter bw = null;
|
||||
File configFile = new File (segmentDir, "storageconfig.txt");
|
||||
File configFile = new File(segmentDir, "storageconfig.txt");
|
||||
List<String> lines = new ArrayList<String>();
|
||||
try
|
||||
{
|
||||
br = new BufferedReader( new FileReader( configFile ) );
|
||||
for ( ;; )
|
||||
{
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(configFile));
|
||||
for (; ; ) {
|
||||
String line = br.readLine();
|
||||
if ( line == null ) break;
|
||||
if ( !line.trim().startsWith( tag ) )
|
||||
{
|
||||
lines.add( line );
|
||||
if (line == null) break;
|
||||
if (!line.trim().startsWith(tag)) {
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
lines.add( tag + value );
|
||||
lines.add(tag + value);
|
||||
br.close();
|
||||
br = null;
|
||||
bw = new BufferedWriter( new FileWriter( configFile ) );
|
||||
for( String line : lines )
|
||||
{
|
||||
bw.write( line + "\r\n" );
|
||||
bw = new BufferedWriter(new FileWriter(configFile));
|
||||
for (String line : lines) {
|
||||
bw.write(line + "\r\n");
|
||||
}
|
||||
}
|
||||
catch (Exception e) { /* ignore */ }
|
||||
finally
|
||||
{
|
||||
if ( br != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
} catch (Exception e) { /* ignore */ } finally {
|
||||
if (br != null) {
|
||||
try {
|
||||
br.close();
|
||||
}
|
||||
catch (Exception ee) { /* ignore */ }
|
||||
} catch (Exception ee) { /* ignore */ }
|
||||
}
|
||||
if ( bw != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
if (bw != null) {
|
||||
try {
|
||||
bw.close();
|
||||
}
|
||||
catch (Exception ee) { /* ignore */ }
|
||||
} catch (Exception ee) { /* ignore */ }
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue