1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 11:21:29 +00:00

lenientMtimes option seems to be false in some cases.

This commit is contained in:
Felix Ableitner 2014-10-16 13:02:24 +03:00
parent 322a297c5e
commit f4565c1bb0

View file

@ -8,6 +8,7 @@ import com.nutomic.syncthingandroid.R;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
@ -155,26 +156,24 @@ public class ConfigXml {
*/
private boolean applyLenientMTimes(Element folder) {
NodeList childs = folder.getChildNodes();
boolean lenientMTimesSet = false;
for (int i = 0; i < childs.getLength(); i++) {
if (childs.item(i).getNodeName().equals("lenientMtimes")) {
// Already set, do nothing (we assume that it is set to true, because nothing could
// change it (no GUI option).
lenientMTimesSet = true;
break;
Node item = childs.item(i);
if (item.getNodeName().equals("lenientMtimes")) {
if (item.getTextContent().equals(Boolean.toString(false))) {
item.setTextContent(Boolean.toString(true));
return true;
}
return false;
}
}
// XML tag does not exist, create it.
if (!lenientMTimesSet) {
Log.i(TAG, "Set 'lenientMtimes' on folder " + folder.getAttribute("id"));
Element newElem = mConfig.createElement("lenientMtimes");
newElem.setTextContent(Boolean.toString(true));
folder.appendChild(newElem);
return true;
}
return false;
}
private Element getGuiElement() {
return (Element) mConfig.getDocumentElement()