Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

[MASSEMBLY-617] add ability to give a fileSuffix to a AbstractPlexusI… #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

tcollignon
Copy link

…oResourceCollection

Hi

In order to fix https://issues.apache.org/jira/browse/MASSEMBLY-617, I need to add a capability to PlexusIoFileResourceCollection, to add file suffix when it package files.
This PR add this feature.

Tell me if something goes wrong

Thx

@@ -149,6 +149,8 @@ private void addResources( List<PlexusIoResource> result, String[] resources,
for ( String name : resources )
{
String sourceDir = name.replace( '\\', '/' );

name = addFileNameSuffix(name);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the whitespace please

@@ -185,6 +187,7 @@ private void addResourcesJava7( List<PlexusIoResource> result, String[] resource
for ( String name : resources )
{
String sourceDir = name.replace( '\\', '/' );
name = addFileNameSuffix(name);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

private String addFileNameSuffix(String name)
{
String nameWithSuffix = name;
if (getFileSuffix() != null && getFileSuffix() != "")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use StringUtils from Plexus Utils here.

{
String[] split = name.split("\\.");
String extension = "." + split[split.length-1];
nameWithSuffix = name.replace(extension, getFileSuffix() + extension);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is not reliable. What about tar.gz or similar?

Copy link
Author

@tcollignon tcollignon Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I'll fix this, but I must write a rule, I add javadoc explanation

@tcollignon
Copy link
Author

And I have swtich the PR here : codehaus-plexus/plexus-io#13

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants