OS independent file separator in Gradle script

This commit is contained in:
Lukasz Antoniak 2012-01-16 17:17:37 +01:00 committed by Strong Liu
parent e52d184b51
commit 755d7fb788

View File

@ -90,9 +90,9 @@ String determinePackageName(SourceDirectorySet sourceDirectorySet, File javaFile
if ( javaFileAbsolutePath.startsWith( sourceDirectoryAbsolutePath ) ) { if ( javaFileAbsolutePath.startsWith( sourceDirectoryAbsolutePath ) ) {
final String javaFileRelativePath = javaFileAbsolutePath.substring( final String javaFileRelativePath = javaFileAbsolutePath.substring(
sourceDirectoryAbsolutePath.length() + 1, sourceDirectoryAbsolutePath.length() + 1,
javaFileAbsolutePath.lastIndexOf( '/' ) javaFileAbsolutePath.lastIndexOf( File.separator )
); );
return javaFileRelativePath.replace( '/', '.' ); return javaFileRelativePath.replace( File.separator, "." );
} }
} }
throw new RuntimeException( "ugh" ); throw new RuntimeException( "ugh" );