Kaydet (Commit) bf549f17 authored tarafından neilm's avatar neilm

Fixed News directory inside parent News directory bug

üst 3dda2aa2
...@@ -172,7 +172,7 @@ public class SubscribedNewsgroups { ...@@ -172,7 +172,7 @@ public class SubscribedNewsgroups {
else else
{ {
// Unix/Linux format "newsrc-staroffice-news.germany.sun.com" // Unix/Linux format "newsrc-staroffice-news.germany.sun.com"
int hostNameStart = filename.indexOf("-") + 1; int hostNameStart = filename.lastIndexOf("newsrc-") + 7;
hostname = filename.substring( hostNameStart, filename.length() ); hostname = filename.substring( hostNameStart, filename.length() );
} }
...@@ -219,13 +219,16 @@ public class SubscribedNewsgroups { ...@@ -219,13 +219,16 @@ public class SubscribedNewsgroups {
//System.out.println( "Finding mailrc for: " + newsDirs[i] ); //System.out.println( "Finding mailrc for: " + newsDirs[i] );
if( newsDirs[i] != null ) if( newsDirs[i] != null )
{ {
File mailrcFiles[] = newsDirs[i].listFiles( new VersionFilter() ); File mailrcFiles[] = newsDirs[i].listFiles( new VersionFilter() );
//System.out.println( "Number found: " + mailrcFiles.length ); if( mailrcFiles != null )
for( int j=0; j < mailrcFiles.length; j++ ) {
{ //System.out.println( "Number found: " + mailrcFiles.length );
//System.out.println( "This mailrc was found: " + mailrcFiles[j] ); for( int j=0; j < mailrcFiles.length; j++ )
allFiles.addElement( mailrcFiles[j] ); {
} //System.out.println( "This mailrc was found: " + mailrcFiles[j] );
allFiles.addElement( mailrcFiles[j] );
}
}
} }
} }
File allMailrcFiles[] = new File[ allFiles.size() ]; File allMailrcFiles[] = new File[ allFiles.size() ];
...@@ -298,7 +301,34 @@ public class SubscribedNewsgroups { ...@@ -298,7 +301,34 @@ public class SubscribedNewsgroups {
} }
else else
{ {
// end recursion
// Check for a News directory inside the News directory (fix for bug)
// Original solution had only "mailrcFile = files[0];"
boolean noChildNews = true;
File checkChildNewsDirs[] = files[0].listFiles(new VersionFilter());
if( checkChildNewsDirs != null )
{
for( int i=0; i < checkChildNewsDirs.length; i++ )
{
if( checkChildNewsDirs[i].getName().equals( "News" ) )
{
noChildNews = false;
break;
}
}
}
if( noChildNews )
{
mailrcFile = files[0]; mailrcFile = files[0];
}
else
{
String childNewsPathName = files[0].getAbsolutePath() + System.getProperty( "file.separator" ) + "News";
mailrcFile = new File( childNewsPathName );
}
} }
// return a File representing the News dir in a profile // return a File representing the News dir in a profile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment