Index: DefaultScriptingManager.java
===================================================================
--- DefaultScriptingManager.java	(revision 1083)
+++ DefaultScriptingManager.java	(revision 1084)
@@ -19,6 +19,7 @@
 import javax.swing.ImageIcon;
 
 import org.apache.commons.lang3.StringUtils;
+import org.gvsig.scripting.DataFolderFound;
 import org.gvsig.scripting.ScriptingBaseScript;
 import org.gvsig.scripting.ScriptingDialog;
 import org.gvsig.scripting.ScriptingExternalFile;
@@ -26,13 +27,16 @@
 import org.gvsig.scripting.ScriptingManager;
 import org.gvsig.scripting.ScriptingScript;
 import org.gvsig.scripting.ScriptingUnit;
+import org.gvsig.tools.packageutils.Version;
 import org.gvsig.tools.script.Script;
 import org.gvsig.tools.service.spi.ProviderFactory;
+import org.gvsig.tools.util.FolderSet;
 import org.python.jsr223.MyPyScriptEngine;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
+@SuppressWarnings("UseSpecificCatch")
 public class DefaultScriptingManager implements ScriptingManager {
 
     public static class RegisterSystemFolder {
@@ -63,6 +67,9 @@
     private File packagesFolder;
     private final Map properties = new HashMap();
     private final Map<String,ScriptEngine> engineGroups = new HashMap<>();
+    private DataFolderManager dataFolderManager = null;
+    private ScriptingFolder userFolder = null;
+    private ScriptingFolder systemFolder = null;
     
     @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
     public DefaultScriptingManager() {
@@ -129,13 +136,27 @@
         this.addLibFolder(new File(this.home, "lib"));
     }
     
+    private DataFolderManager getDataFolderManager() {
+        if( this.dataFolderManager==null ) {
+            this.dataFolderManager = new DataFolderManager(this);
+        }
+        return this.dataFolderManager;
+    }
+    
     @Override
     public File getDataFolder(String id) {
-        File f = FileUtils.getFile(getHomeFolder(), "data",id);
-        createFolder(f);
-        return f;
+        return this.getDataFolderManager().getDataFolder(id);
     }
 
+    public void registerDataFolder(ScriptingFolder folderScript, String id ) {
+        this.getDataFolderManager().registerDataFolder(folderScript, id);
+    }
+
+    @Override
+    public List<DataFolderFound> searchOldVersions(Version currentVersion, FolderSet folder) {
+        return this.getDataFolderManager().searchOldVersions(currentVersion, folder);
+    }
+    
     protected synchronized ScriptEngineManager getEngineManager() {
         if (this.engineManager == null) {
             this.engineManager
@@ -379,12 +400,32 @@
         return folder;
     }
 
+    public ScriptingUnit getUnit(String pathName) {
+        ScriptingUnit unit = null;
+        String[] parts = StringUtils.split(pathName, '/');
+        if( pathName.equals(this.getUserFolder().getName()) ) {
+            unit = this.getUserFolder().getUnit( 
+                    StringUtils.join(parts, "/", 1, parts.length) 
+            );
+        } else if( pathName.equals(this.getSystemFolder().getName()) ) {
+            unit = this.getSystemFolder().getUnit( 
+                    StringUtils.join(parts, "/", 1, parts.length) 
+            );
+        } 
+        return unit;
+    }
+    
     public ScriptingUnit getUnit(File file) {
         ScriptingFolder folder;
         ScriptingUnit unit;
 
         if (file.isAbsolute()) {
-            folder = new DefaultScriptingFolder(null, this, file.getParentFile());
+            if( FileUtils.isSameFile(this.getRootUserFolder(), file.getParentFile()) ) {
+                folder = this.getUserFolder();
+                // FIXME: que pasa si esta en SystemFolder ???
+            } else {
+                folder = new DefaultScriptingFolder(null, this, file.getParentFile());
+            }
             unit = folder.getUnit(file);
             return unit;
         } else {
@@ -405,12 +446,18 @@
 
     @Override
     public ScriptingFolder getSystemFolder() {
-        return new SystemFolder(this);
+        if( this.systemFolder == null ) {
+            this.systemFolder = new SystemFolder(this);
+        }
+        return  this.systemFolder;
     }
 
     @Override
     public ScriptingFolder getUserFolder() {
-        return new UserFolder(this, this.getRootUserFolder());
+        if( this.userFolder == null ) {
+            this.userFolder = new UserFolder(this, this.getRootUserFolder());
+        }
+        return  this.userFolder;
     }
 
     @Override
