Fixed an issue with saving configuration on Windows
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import javax.annotation.Nonnull;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -42,7 +41,6 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -301,7 +299,7 @@ public class MZmineConfigurationImpl implements MZmineConfiguration {
// Java fails to write into hidden files on Windows, see
// https://bugs.openjdk.java.net/browse/JDK-8047342
- if (System.getProperty("os.name").toLowerCase().contains("windows")) {
+ if (file.exists() && System.getProperty("os.name").toLowerCase().contains("windows")) {
if ((Boolean) Files.getAttribute(file.toPath(), "dos:hidden", LinkOption.NOFOLLOW_LINKS)) {
Files.setAttribute(file.toPath(), "dos:hidden", Boolean.FALSE, LinkOption.NOFOLLOW_LINKS);
}
