1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 19:31:30 +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.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -155,25 +156,23 @@ public class ConfigXml {
*/ */
private boolean applyLenientMTimes(Element folder) { private boolean applyLenientMTimes(Element folder) {
NodeList childs = folder.getChildNodes(); NodeList childs = folder.getChildNodes();
boolean lenientMTimesSet = false;
for (int i = 0; i < childs.getLength(); i++) { for (int i = 0; i < childs.getLength(); i++) {
if (childs.item(i).getNodeName().equals("lenientMtimes")) { Node item = childs.item(i);
// Already set, do nothing (we assume that it is set to true, because nothing could if (item.getNodeName().equals("lenientMtimes")) {
// change it (no GUI option). if (item.getTextContent().equals(Boolean.toString(false))) {
lenientMTimesSet = true; item.setTextContent(Boolean.toString(true));
break; return true;
}
return false;
} }
} }
// XML tag does not exist, create it. // XML tag does not exist, create it.
if (!lenientMTimesSet) { Log.i(TAG, "Set 'lenientMtimes' on folder " + folder.getAttribute("id"));
Log.i(TAG, "Set 'lenientMtimes' on folder " + folder.getAttribute("id")); Element newElem = mConfig.createElement("lenientMtimes");
Element newElem = mConfig.createElement("lenientMtimes"); newElem.setTextContent(Boolean.toString(true));
newElem.setTextContent(Boolean.toString(true)); folder.appendChild(newElem);
folder.appendChild(newElem); return true;
return true;
}
return false;
} }
private Element getGuiElement() { private Element getGuiElement() {