public String getConfigPath (String filename) {
        if (eng.isApplet()) return null;
        File jgamedir;
        try {
            jgamedir = new File(System.getProperty("user.home"), ".jgame");
        }
        catch (Exception e) {
            // probably AccessControlException of unsigned webstart
            return null;
        }
        if (!jgamedir.exists()) {
            // try to create ".jgame"
            if (!jgamedir.mkdir()) {
                // fail
                return null;
            }
        }
        if (!jgamedir.isDirectory()) return null;
        File file = new File(jgamedir, filename);
        // try to create file if it didn't exist
        try {
            file.createNewFile();
        }
        catch (IOException e) {
            return null;
        }
        if (!file.canRead()) return null;
        if (!file.canWrite()) return null;
        try {
            return file.getCanonicalPath();
        }
        catch (IOException e) {
            return null;
        }
    }