diff --git a/sdk/jme3-core/src/com/jme3/gde/core/Installer.java b/sdk/jme3-core/src/com/jme3/gde/core/Installer.java index 62f387a5c..57fbbcdaa 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/Installer.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/Installer.java @@ -32,9 +32,11 @@ package com.jme3.gde.core; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.upgrader.Upgrader; import java.io.File; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.JPopupMenu; -import org.netbeans.upgrade.AutoUpgrade; import org.openide.filesystems.FileChooserBuilder; import org.openide.modules.ModuleInstall; import org.openide.util.Exceptions; @@ -47,6 +49,8 @@ import org.openide.util.NbPreferences; */ public class Installer extends ModuleInstall { + private static final Logger logger = Logger.getLogger(Installer.class.getName()); + @Override public boolean closing() { SceneApplication.getApplication().stop(); @@ -68,8 +72,9 @@ public class Installer extends ModuleInstall { String projectDir = NbPreferences.forModule(Installer.class).get("projects_path", null); if (projectDir == null) { try { - AutoUpgrade.main(new String[]{}); - NbPreferences.root().sync(); + Upgrader.checkUpgrade(); + NbPreferences.forModule(Installer.class).sync(); + logger.log(Level.INFO, "Synced settings"); } catch (Exception ex) { Exceptions.printStackTrace(ex); } @@ -90,12 +95,14 @@ public class Installer extends ModuleInstall { } } //netbeans.default_userdir_root + logger.log(Level.INFO, "Set project dir {0}", projectDir); System.setProperty("netbeans.projects.dir", projectDir); //set extraction dir for platform natives String jmpDir = System.getProperty("netbeans.user"); File file = new File(jmpDir); if (!file.exists()) { + logger.log(Level.INFO, "Create settings dir {0}", projectDir); file.mkdirs(); } com.jme3.system.Natives.setExtractionDir(jmpDir); diff --git a/sdk/jme3-upgrader/src/com/jme3/gde/upgrader/Upgrader.java b/sdk/jme3-upgrader/src/com/jme3/gde/upgrader/Upgrader.java new file mode 100644 index 000000000..1296212ce --- /dev/null +++ b/sdk/jme3-upgrader/src/com/jme3/gde/upgrader/Upgrader.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.jme3.gde.upgrader; + +import java.util.logging.Level; +import java.util.logging.Logger; +import org.netbeans.upgrade.AutoUpgrade; +import org.openide.util.Exceptions; + +/** + * + * @author normenhansen + */ +public class Upgrader { + private static final Logger logger = Logger.getLogger(Upgrader.class.getName()); + public static void checkUpgrade(){ + try { + logger.log(Level.INFO, "Start upgrade.."); + AutoUpgrade.main(new String[0]); + logger.log(Level.INFO, "Finished upgrade."); + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } + } + +} diff --git a/sdk/jme3-upgrader/src/org/netbeans/upgrade/AutoUpgrade.java b/sdk/jme3-upgrader/src/org/netbeans/upgrade/AutoUpgrade.java index fd39fe14c..ee70c359f 100644 --- a/sdk/jme3-upgrader/src/org/netbeans/upgrade/AutoUpgrade.java +++ b/sdk/jme3-upgrader/src/org/netbeans/upgrade/AutoUpgrade.java @@ -49,6 +49,7 @@ import java.net.URL; import java.util.Arrays; import java.util.Iterator; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JDialog; import javax.swing.JOptionPane; @@ -126,18 +127,20 @@ public final class AutoUpgrade { private static File checkPreviousOnOsSpecificPlace (final List versionsToCheck) { String defaultUserdirRoot = System.getProperty ("netbeans.default_userdir_root"); // NOI18N //normen: to test in ide - if(defaultUserdirRoot==null){ + if(defaultUserdirRoot == null){ try { defaultUserdirRoot = new File(System.getProperty("netbeans.user")).getParentFile().getCanonicalPath(); - } catch (IOException ex) { + } catch (Exception ex) { Exceptions.printStackTrace(ex); } } + LOGGER.log(Level.INFO, "determined userdir root of {0}", defaultUserdirRoot); File sourceFolder; if (defaultUserdirRoot != null) { File userHomeFile = new File (defaultUserdirRoot); for (String ver : versionsToCheck) { sourceFolder = new File (userHomeFile.getAbsolutePath (), ver); + LOGGER.log(Level.INFO, "Look for {0} ", userHomeFile); if (sourceFolder.exists () && sourceFolder.isDirectory ()) { return sourceFolder; } @@ -157,7 +160,7 @@ public final class AutoUpgrade { while (it.hasNext () && sourceFolder == null) { ver = it.next (); sourceFolder = new File (userHomeFile.getAbsolutePath (), ver); - + LOGGER.log(Level.INFO, "Look for previous {0} ", userHomeFile); if (sourceFolder.isDirectory ()) { break; }