geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1158880 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Date Wed, 17 Aug 2011 19:32:52 GMT
Author: gawor
Date: Wed Aug 17 19:32:51 2011
New Revision: 1158880

URL: http://svn.apache.org/viewvc?rev=1158880&view=rev
Log:
create parent directory when copying files over

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=1158880&r1=1158879&r2=1158880&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Wed Aug 17 19:32:51 2011
@@ -1015,6 +1015,13 @@ public class GeronimoServerBehaviourDele
                 break;
             case IModuleResourceDelta.ADDED:
             case IModuleResourceDelta.CHANGED:
+                File parentFile = file.getParentFile();
+                if (parentFile != null && !parentFile.exists()) {
+                    if (!parentFile.mkdirs()) {
+                        Trace.trace(Trace.ERROR, "Cannot create target directory: " + parentFile,
Activator.logCore);
+                        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot create
target directory", null);
+                    }
+                }
                 String rootFolder = GeronimoUtils.getVirtualComponent(module).getRootFolder().getProjectRelativePath().toOSString();
                 String sourceFile = module.getProject().getFile(rootFolder + ch + moduleFile.getModuleRelativePath()
+ ch + moduleFile.getName()).getLocation().toString();
                 
@@ -1027,7 +1034,6 @@ public class GeronimoServerBehaviourDele
                     while ((bytesRead = in.read(buffer)) > 0) {
                         out.write(buffer, 0, bytesRead);
                     }
-
                 } catch (FileNotFoundException e) {
                     Trace.trace(Trace.ERROR, "Cannot find file to copy: " + sourceFile, e,
Activator.logCore);
                     return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot find file
" + sourceFile, e);



Mime
View raw message