<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,6 +3,9 @@
 
 var File = require(&quot;file&quot;);
 
+var FILE = File;
+var OBJJ = require(&quot;objj/objj&quot;);
+var SYSTEM = require(&quot;system&quot;);
 
 function gen(/*va_args*/)
 {
@@ -58,12 +61,12 @@ function gen(/*va_args*/)
         config = {};
     if (File.isFile(configFile))
         config = JSON.parse(File.read(configFile));
-    print(config.FrameworksPath)
+    
     var destinationProject = new java.io.File(destination),
         configuration = noConfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration];
 
     if (justFrameworks)
-        createFrameworksInFile(destinationProject, shouldSymbolicallyLink, force);
+        createFrameworksInFile(String(destinationProject.getCanonicalPath()), shouldSymbolicallyLink, force);
 
     else if (!destinationProject.exists())
     {
@@ -106,65 +109,60 @@ function gen(/*va_args*/)
         print(&quot;Directory already exists&quot;);
 }
 
-
-function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ shouldSymbolicallyLink, /*Boolean*/ force)
+function createFrameworksInFile(/*String*/ aFile, /*Boolean*/ symlink, /*Boolean*/ force)
 {
-    if (!File.isDirectory(aFile))
-        throw new Error(&quot;Can't create Frameworks. Directory does not exist: &quot; + aFile);
-        
-    var destinationFrameworks = new java.io.File(aFile+ &quot;/Frameworks&quot;),
-        destinationDebugFrameworks = new java.io.File(aFile + &quot;/Frameworks/Debug&quot;);
-        
-    if (destinationFrameworks.exists()) {
-        if (force) {
-            print(&quot;Updating existing Frameworks directory.&quot;);
-            exec([&quot;rm&quot;, &quot;-rf&quot;, destinationFrameworks], true);
-        }
-        else {
-            print(&quot;Frameworks directory already exists. Use --force to overwrite.&quot;);
-            return;
-        }
-    } else {    
-        print(&quot;Creating Frameworks directory in &quot;+destinationFrameworks+&quot;.&quot;);
-    }
-
-    if (!shouldSymbolicallyLink)
-    {
-        var sourceFrameworks = new java.io.File(OBJJ_HOME + &quot;/lib/Frameworks&quot;);
+    var destination = FILE.path(aFile);
     
-        exec([&quot;cp&quot;, &quot;-R&quot;, sourceFrameworks.getCanonicalPath(), destinationFrameworks], true);
-
-        return;
-    }
-    
-    var BUILD = system.env[&quot;CAPP_BUILD&quot;] || system.env[&quot;STEAM_BUILD&quot;];
+    if (!destination.isDirectory())
+        throw new Error(&quot;Can't create Frameworks. Directory does not exist: &quot; + destination);
     
-    if (!BUILD)
+    if (symlink &amp;&amp; !(SYSTEM.env[&quot;CAPP_BUILD&quot;] || SYSTEM.env[&quot;STEAM_BUILD&quot;]))
         throw &quot;CAPP_BUILD or STEAM_BUILD must be defined&quot;;
+
+    var installedFrameworks = FILE.path(FILE.join(OBJJ.OBJJ_HOME, &quot;lib&quot;, &quot;Frameworks&quot;)),
+        builtFrameworks = FILE.path(SYSTEM.env[&quot;CAPP_BUILD&quot;] || SYSTEM.env[&quot;STEAM_BUILD&quot;]);
     
-    // Release Frameworks
-    new java.io.File(destinationFrameworks).mkdir();
+    var sourceFrameworks = symlink ? builtFrameworks.join(&quot;Release&quot;) : installedFrameworks,
+        sourceDebugFrameworks = symlink ? builtFrameworks.join(&quot;Debug&quot;) : installedFrameworks.join(&quot;Debug&quot;);
+        
+    var destinationFrameworks = destination.join(&quot;Frameworks&quot;),
+        destinationDebugFrameworks = destination.join(&quot;Frameworks&quot;, &quot;Debug&quot;);
     
-    exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(BUILD + &quot;/Release/Objective-J&quot;).getCanonicalPath(),
-                        new java.io.File(aFile + &quot;/Frameworks/Objective-J&quot;).getCanonicalPath()], true);
-
-    exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(BUILD + &quot;/Release/Foundation&quot;).getCanonicalPath(),
-                        new java.io.File(aFile + &quot;/Frameworks/Foundation&quot;).getCanonicalPath()], true);
-
-    exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(BUILD + &quot;/Release/AppKit&quot;).getCanonicalPath(),
-                        new java.io.File(aFile + &quot;/Frameworks/AppKit&quot;).getCanonicalPath()], true);
-
-    // Debug Frameworks
-    new java.io.File(destinationDebugFrameworks).mkdir();
+    print(&quot;Creating Frameworks directory in &quot; + destinationFrameworks + &quot;.&quot;);
     
-    exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(BUILD + &quot;/Debug/Objective-J&quot;).getCanonicalPath(),
-                        new java.io.File(aFile + &quot;/Frameworks/Debug/Objective-J&quot;).getCanonicalPath()], true);
-
-    exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(BUILD + &quot;/Debug/Foundation&quot;).getCanonicalPath(),
-                        new java.io.File(aFile + &quot;/Frameworks/Debug/Foundation&quot;).getCanonicalPath()], true);
+    //destinationFrameworks.mkdirs(); // redundant
+    destinationDebugFrameworks.mkdirs();
+    
+    [&quot;Objective-J&quot;, &quot;Foundation&quot;, &quot;AppKit&quot;].forEach(function(framework) {
+        installFramework(
+            sourceFrameworks.join(framework),
+            destinationFrameworks.join(framework),
+            force, symlink);
+        installFramework(
+            sourceDebugFrameworks.join(framework),
+            destinationDebugFrameworks.join(framework),
+            force, symlink);
+    });
+}
 
-    exec([&quot;ln&quot;, &quot;-s&quot;,   new java.io.File(BUILD + &quot;/Debug/AppKit&quot;).getCanonicalPath(),
-                        new java.io.File(aFile + &quot;/Frameworks/Debug/AppKit&quot;).getCanonicalPath()], true);
+function installFramework(source, dest, force, symlink) {
+    if (dest.exists()) {
+        if (force) {
+            dest.rmtree();
+        } else {
+            print(&quot;Warning: &quot; + dest + &quot; already exists. Use --force to overwrite.&quot;);
+            return;
+        }
+    }
+    if (source.exists()) {
+        print((symlink ? &quot;Symlinking &quot; : &quot;Copying &quot;) + source + &quot; to &quot; + dest);
+        if (symlink)
+            FILE.symlink(source, dest);
+        else
+            FILE.copyTree(source, dest);
+    }
+    else
+        print(&quot;Warning: &quot;+source+&quot; doesn't exist.&quot;);
 }
 
 function toIdentifier(/*String*/ aString)</diff>
      <filename>Tools/capp/Generate.j</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>315e0eac0c510d583f458aa0ee03255f925e1830</id>
    </parent>
  </parents>
  <author>
    <name>Tom Robinson</name>
    <email>tom@280north.com</email>
  </author>
  <url>http://github.com/jsmecham/cappuccino/commit/b050559532ceef43508b48f9314a1634406ef48b</url>
  <id>b050559532ceef43508b48f9314a1634406ef48b</id>
  <committed-date>2009-10-27T17:38:31-07:00</committed-date>
  <authored-date>2009-10-27T17:38:31-07:00</authored-date>
  <message>Improved capp gen. Don't blow away entire Frameworks directory with --force, just Objj/Foundation/AppKit.</message>
  <tree>c1138e94f21437fae83843470967531364f2af8d</tree>
  <committer>
    <name>Tom Robinson</name>
    <email>tom@280north.com</email>
  </committer>
</commit>
