Tobias Larscheid created CB-14262:
-------------------------------------

             Summary: Cordova does not allow creating and editing resource files
                 Key: CB-14262
                 URL: https://issues.apache.org/jira/browse/CB-14262
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-android
    Affects Versions: 7.0.0
            Reporter: Tobias Larscheid


Hi,

in my cordova plugin, I am trying to edit the resulting android apps 
`colors.xml` file. Unfortunately, by default the android app cordova creates 
does not have a `colors.xml` file - this means the following code does nothing, 
as a non existent file is simply ignored (without warning or error).
{code:java}
<config-file target="./res/values/colors.xml" parent="/resources">
    <color name="my-color">#F00000</color>
</config-file>{code}
What I tried instead now was first creating the file by simply copying over an 
empty one with the `resource-file` directive and then editing it, resulting in 
a plugin.xml like the following:
{code:java}
<resource-file src="path/to/colors.xml" 
target="app/src/main/res/values/colors.xml" />

<config-file target="./res/values/colors.xml" parent="/resources">
    <color name="my-color">#F00000</color>
</config-file>{code}
The file is copied to the correct place, but still not modified. I am guessing 
that `config-file` is somehow executed earlier than `resource-file`.

Also if I simply add my color to *strings*.xml, it works flawlessly - because 
the android app build with cordova does indeed contain a strings.xml by default.

What I would like to achieve now is either

a) make the `config-file` directive lazily create the colors.xml if it doesn't 
exist

b) create an empty colors.xml and fill it with the `config-file` directive

 

Any ideas are welcome!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to