From 31279a0cdcdbb8d57fad9b3a0ebcf02e30f576f2 Mon Sep 17 00:00:00 2001 From: Francisco Tolmasky Date: Wed, 18 Mar 2009 16:37:06 -0700 Subject: [PATCH] Fix for copy bug and added capp changes. Reviewed by me. --- AppKit/Tools/BlendKit/rakefile | 2 +- AppKit/rakefile | 2 +- Foundation/CPBundle.j | 5 +++++ Foundation/rakefile | 2 +- Objective-J/rakefile | 2 +- Tools/capp/Rakefile | 2 +- Tools/capp/main.j | 26 +++++++++++++++++++------- 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/AppKit/Tools/BlendKit/rakefile b/AppKit/Tools/BlendKit/rakefile index bdcad5ff4..d64831f9a 100644 --- a/AppKit/Tools/BlendKit/rakefile +++ b/AppKit/Tools/BlendKit/rakefile @@ -27,5 +27,5 @@ end #Framework in environment directory file_d $ENVIRONMENT_PRODUCT => [:BlendKit] do - cp_r($BUILD_PATH, $ENVIRONMENT_PRODUCT) + cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT) end diff --git a/AppKit/rakefile b/AppKit/rakefile index f5888a5ab..d7a944118 100644 --- a/AppKit/rakefile +++ b/AppKit/rakefile @@ -33,7 +33,7 @@ end #Framework in environment directory file_d $ENVIRONMENT_PRODUCT => [:AppKit] do - cp_r($BUILD_PATH, $ENVIRONMENT_PRODUCT) + cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT) end ThemeFiles = FileList['Themes/Aristo/*'] diff --git a/Foundation/CPBundle.j b/Foundation/CPBundle.j index 32736b885..56ad05349 100644 --- a/Foundation/CPBundle.j +++ b/Foundation/CPBundle.j @@ -93,6 +93,11 @@ return className ? CPClassFromString(className) : Nil; } +- (CPString)pathForResource:(CPString)aFilename +{ + return [self resourcePath] + '/' + aFilename; +} + - (CPDictionary)infoDictionary { return info; diff --git a/Foundation/rakefile b/Foundation/rakefile index e9fc33948..00ca83da1 100644 --- a/Foundation/rakefile +++ b/Foundation/rakefile @@ -27,5 +27,5 @@ end #Framework in environment directory file_d $ENVIRONMENT_PRODUCT => [:Foundation] do - cp_r($BUILD_PATH, $ENVIRONMENT_PRODUCT) + cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT) end diff --git a/Objective-J/rakefile b/Objective-J/rakefile index 99aed6c05..f20ce68dc 100644 --- a/Objective-J/rakefile +++ b/Objective-J/rakefile @@ -46,7 +46,7 @@ end #Framework in environment directory file_d $ENVIRONMENT_PRODUCT => [:Products] do - cp_r($PRODUCT, $ENVIRONMENT_PRODUCT) + cp_r(File.join($PRODUCT, '.'), $ENVIRONMENT_PRODUCT) end def platform_flags(*platforms) diff --git a/Tools/capp/Rakefile b/Tools/capp/Rakefile index 13f047fdf..afd9c0ec9 100644 --- a/Tools/capp/Rakefile +++ b/Tools/capp/Rakefile @@ -22,7 +22,7 @@ ObjectiveJ::BundleTask.new(:capp) do |t| t.email = 'feedback @nospam@ 280north.com' t.summary = 'Setup up Cappuccino projects' t.sources = FileList['*.j'] - t.resources = FileList['Resources/*'] + t.resources = FileList['Resources/*', 'Templates'] t.license = ObjectiveJ::License::LGPL_v2_1 t.build_path = $BUILD_PATH t.flag = 'DEBUG' if $CONFIGURATION == 'Debug' diff --git a/Tools/capp/main.j b/Tools/capp/main.j index 6d3545d49..024fdd617 100644 --- a/Tools/capp/main.j +++ b/Tools/capp/main.j @@ -1,14 +1,18 @@ +importClass(java.lang.System); importClass(java.io.File); +importClass(java.io.FileWriter); importClass(java.io.FileOutputStream); importClass(java.io.BufferedWriter); importClass(java.io.OutputStreamWriter); +@import + function main() { if (arguments.length < 1) return printUsage(); - + var index = 0, count = arguments.length, @@ -43,7 +47,7 @@ function main() } } - var sourceTemplate = new File(OBJJ_HOME + "/lib/steam/Templates/" + template), + var sourceTemplate = new File(OBJJ_HOME + "/lib/capp/Resources/Templates/" + template), destinationProject = new File(destination); if (!destinationProject.exists()) @@ -67,7 +71,7 @@ function main() createFrameworksInFile(destinationProject, shouldSymbolicallyLink); } else - System.out.println("Directory already exists"); + print("Directory already exists"); } function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLink) @@ -77,12 +81,10 @@ function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLi if (!shouldSymbolicallyLink) { - var sourceFrameworks = new File(OBJJ_HOME + "/lib/Frameworks"), - sourceDebugFrameworks = new File(OBJJ_HOME + "/lib/Frameworks-Debug"); + var sourceFrameworks = new File(OBJJ_HOME + "/lib/Frameworks"); exec(["cp", "-vR", sourceFrameworks.getCanonicalPath(), destinationFrameworks.getCanonicalPath()], true); - exec(["cp", "-vR", sourceDebugFrameworks.getCanonicalPath(), destinationDebugFrameworks.getCanonicalPath()], true); - + return true; } @@ -117,3 +119,13 @@ function printUsage() { print("capp /path/to/your/app [options]"); } + + +function writeContentsToFile(/*String*/ aString, /*File*/ aFile) +{ + var writer = new BufferedWriter(new FileWriter(aFile)); + + writer.write(aString); + + writer.close(); +}