diff --git a/engine/src/desktop/com/jme3/system/Natives.java b/engine/src/desktop/com/jme3/system/Natives.java index a5f8ba16e..8071e4f74 100644 --- a/engine/src/desktop/com/jme3/system/Natives.java +++ b/engine/src/desktop/com/jme3/system/Natives.java @@ -65,19 +65,30 @@ public class Natives { if (extractionDir == null) { File workingFolder = new File("").getAbsoluteFile(); if (workingFolder.getUsableSpace() == 0 || !workingFolder.canWrite()) { - logger.log(Level.WARNING, "Working directory is not writable. Using home directory instead."); - extractionDir = new File(JmeSystem.getStorageFolder(), - "natives_" + Integer.toHexString(computeNativesHash())); - if (!extractionDir.exists()) { - extractionDir.mkdir(); - } + setStorageExtractionDir(); } else { - extractionDir = workingFolder; + try { + File file = new File(workingFolder.getAbsolutePath() + File.separator + ".jmetestwrite"); + file.createNewFile(); + file.delete(); + extractionDir = workingFolder; + } catch (Exception e) { + setStorageExtractionDir(); + } } } return extractionDir; } + private static void setStorageExtractionDir() { + logger.log(Level.WARNING, "Working directory is not writable. Using home directory instead."); + extractionDir = new File(JmeSystem.getStorageFolder(), + "natives_" + Integer.toHexString(computeNativesHash())); + if (!extractionDir.exists()) { + extractionDir.mkdir(); + } + } + private static int computeNativesHash() { try { String classpath = System.getProperty("java.class.path");