Skip to content

Commit

Permalink
Add method for expanding the number of builtin directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-resnick committed Aug 31, 2011
1 parent a9ead55 commit e1a39e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/main/org/freecompany/redline/payload/Contents.java
Expand Up @@ -309,6 +309,16 @@ protected synchronized void addParents( final File file, final int permissions,
for ( String parent : parents) addDirectory( parent, permissions, null, uname, gname);
}

/**
* Add additional directory that is assumed to already exist on system where the RPM will be installed
* (e.g. /etc) and should not have an entry in the RPM.
*
* @param directory
*/
public synchronized static void addBuiltinDirectory( final String directory) {
builtin.add(directory);
}

/**
* Retrieve the size of this archive in number of files. This count includes both directory entries and
* soft links.
Expand Down
11 changes: 11 additions & 0 deletions source/test/org/freecompany/redline/payload/ContentsTest.java
Expand Up @@ -25,4 +25,15 @@ public void testListParentsBuiltin() throws Exception {
assertEquals( "/bin/one/two", list.get( 1));
assertEquals( "/bin/one", list.get( 2));
}

public void testListParentsNewBuiltin() throws Exception {
ArrayList< String> list = new ArrayList< String>();
Contents.addBuiltinDirectory("/home");
Contents.listParents( list, new File( "/home/one/two/three/four"));

assertEquals( 3, list.size());
assertEquals( "/home/one/two/three", list.get( 0));
assertEquals( "/home/one/two", list.get( 1));
assertEquals( "/home/one", list.get( 2));
}
}

0 comments on commit e1a39e6

Please sign in to comment.