src/main/java/com/simpligility/maven/plugins/android/standalonemojos/PushMojo.java
private Map<String, String> calculateSourceDestinationMapping() throws MojoExecutionException
    {
        Map<String, String> result = new HashMap<String, String>();

        File sourceFile = new File( parsedSource );
        final String destinationPath;
        if ( parsedDestination.endsWith( "/" ) )
        {
            destinationPath = parsedDestination + sourceFile.getName();
        }
        else
        {
            destinationPath = parsedDestination;
        }

        if ( sourceFile.isFile() )
        {
            // only put the source in
            final String sourcePath = sourceFile.getAbsolutePath();
            result.put( sourcePath, destinationPath );
        }
        else
        {
            if ( sourceFile.isDirectory() )
            {
                // find recursively all files to be pushed
                @SuppressWarnings( "unchecked" ) Collection<File> filesList = FileUtils
                        .listFiles( sourceFile, null, true );
                for ( File file : filesList )
                {
                    // make the file's path relative - this is kind of a hack but it
                    // works just fine in this controlled environment
                    String filePath = file.getAbsolutePath().substring( sourceFile.getAbsolutePath().length() );
                    filePath = filePath.replace( System.getProperty( "file.separator" ), "/" );
                    result.put( file.getAbsolutePath(), destinationPath + filePath );
                }
            }
            else
            {
                throw new MojoExecutionException( "Cannot execute push goal: File or directory "
                        + sourceFile.getAbsolutePath() + " does not exist." );
            }
        }
        return result;
    }
private Map<String, String> calculateSourceDestinationMapping() throws MojoExecutionException
    {
        Map<String, String> result = new HashMap<String, String>();

        File sourceFile = new File( parsedSource );
        final String destinationPath;
        if ( parsedDestination.endsWith( "/" ) )
        {
            destinationPath = parsedDestination + sourceFile.getName();
        }
        else
        {
            destinationPath = parsedDestination;
        }

        if ( sourceFile.isFile() )
        {
            // only put the source in
            final String sourcePath = sourceFile.getAbsolutePath();
            result.put( sourcePath, destinationPath );
        }
        else
        {
            if ( sourceFile.isDirectory() )
            {
                // find recursively all files to be pushed
                @SuppressWarnings( "unchecked" ) Collection<File> filesList = FileUtils
                        .listFiles( sourceFile, null, true );
                for ( File file : filesList )
                {
                    // make the file's path relative - this is kind of a hack but it
                    // works just fine in this controlled environment
                    String filePath = file.getAbsolutePath().substring( sourceFile.getAbsolutePath().length() );
                    filePath = filePath.replace( System.getProperty( "file.separator" ), "/" );
                    result.put( file.getAbsolutePath(), destinationPath + filePath );
                }
            }
            else
            {
                throw new MojoExecutionException( "Cannot execute push goal: File or directory "
                        + sourceFile.getAbsolutePath() + " does not exist." );
            }
        }
        return result;
    }
private Map < String , String > calculateSourceDestinationMapping ( ) throws MojoExecutionException { Map < String , String > result = new HashMap < String , String > ( ) ; File sourceFile = new File ( parsedSource ) ; final String destinationPath ; if ( parsedDestination . endsWith ( "/" ) ) { destinationPath = parsedDestination + sourceFile . getName ( ) ; } else { destinationPath = parsedDestination ; } if ( sourceFile . isFile ( ) ) { // only put the source in final String sourcePath = sourceFile . getAbsolutePath ( ) ; result . put ( sourcePath , destinationPath ) ; } else { if ( sourceFile . isDirectory ( ) ) { // find recursively all files to be pushed @ SuppressWarnings ( "unchecked" ) Collection < File > filesList = FileUtils . listFiles ( sourceFile , null , true ) ; for ( File file : filesList ) { // make the file's path relative - this is kind of a hack but it // works just fine in this controlled environment String filePath = file . getAbsolutePath ( ) . substring ( sourceFile . getAbsolutePath ( ) . length ( ) ) ; filePath = filePath . replace ( System . getProperty ( "file.separator" ) , "/" ) ; result . put ( file . getAbsolutePath ( ) , destinationPath + filePath ) ; } } else { throw new MojoExecutionException ( "Cannot execute push goal: File or directory " + sourceFile . getAbsolutePath ( ) + " does not exist." ) ; } } return result ; }
Calculates a map which contains all files to be pushed to the device or
emulator. The source filename works as the key while the value is the
destination.

@return a map with file source -> destination pairs
@throws MojoExecutionException
Calculates a map which contains all files to be pushed to the device or emulator . The source filename works as the key while the value is the destination .