How is -adaptresourcefilenames supposed to work?

I have .jar with the following structure:

├── META-INF
│   ├── MANIFEST.MF
│   └── notes
│       └── com.my.company.app.HelloWorld
└── com
    └── my
        └── company
            └── app
                └── HelloWorld.class

(the META-INF/notes/com.my.company.app.HelloWorld contains text “com.my.company.app.HelloWorld”).

After I run “java -jar proguard-base-6.2.2.jar @my.pro” with the following config:

-libraryjars <java.home>/lib/rt.jar
-injars       my/target/my.jar
-outjars      my/target/my-obf.jar
-printmapping obfuscation.map
-adaptresourcefilecontents META-INF/notes/*
-adaptresourcefilenames META-INF/notes/*
-dontoptimize
-dontshrink

I get a .jar with the class file renamed (as expected), resource file content obfuscated (as expected), but not renamed:

├── META-INF
│   ├── MANIFEST.MF
│   └── notes
│       └── com.my.company.app.HelloWorld
└── a
    └── a
        └── a
            └── a
                └── a.class

Why doesn’t file “META-INF/notes/com.my.company.app.HelloWorld” get renamed to “META-INF/notes/a.a.a.a.a”? It gets processed by the Proguard as its content changes to “a.a.a.a.a”, but its name stays the same.

HI @foozer_boozer,

First of all, a big welcome to ProGuard Community!

To address your question, while it’s not very clear in the documentation, this will only work if the file is in the same directory structure as the class file. And, it must also possess a file extension, such as a .txt - lets look at an example:

── com
    └── my
        └── company
            └── app
                └── HelloWorld.class
                └── HelloWorld.txt

In the case above, you could provide a rule like this:
-adaptresourcefilenames **.txt

Please let us know if anything remains unclear.

Kindest Regards,

Jack