Since the check on packages name ( #70 ) , it's not possible anymore to create a resource in a resource dir that does not respect a package name.
Example, I can't create a new META-INF/data.txt file, because the META-INF does not respect the package name.
This was explained till #70 (comment) ; I create a separate issue for convenience.
The solution I think would be correct is
- create the JResourceDirectory class (same level as JPackage)
- move the method addResourceFile from JPackage to JResourceDirectory.
- add sub-dir creation in this class, and the root JResourceDirectory in JCodemodel - basically like the package. Also the JCodemodel should have a Map of JResourceDirectory, by name.
- add JPackage to JResourceDir translation, typically with
public JResourceDir JPackage::asResourceDir(){return m_aOwner.getResourceDir(m_sName);}
- add again addResourceFile in JPackage , but calling corresponding resource dir
public AbstractJResourceFile JPackage::addResourceFile (@Nonnull final AbstractJResourceFile rsrc){return asResourceDir().addResourceFile(rsrc);} ; and same for the other methods.
Possibly you can make JPackage extend JResourceDir. Still, overload the methods to call the resource dir when creating resources.
Since the check on packages name ( #70 ) , it's not possible anymore to create a resource in a resource dir that does not respect a package name.
Example, I can't create a new META-INF/data.txt file, because the META-INF does not respect the package name.
This was explained till #70 (comment) ; I create a separate issue for convenience.
The solution I think would be correct is
public JResourceDir JPackage::asResourceDir(){return m_aOwner.getResourceDir(m_sName);}public AbstractJResourceFile JPackage::addResourceFile (@Nonnull final AbstractJResourceFile rsrc){return asResourceDir().addResourceFile(rsrc);}; and same for the other methods.Possibly you can make JPackage extend JResourceDir. Still, overload the methods to call the resource dir when creating resources.