From b99c4deb4963972b699e48328c45ccc4292d6d6f Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Wed, 22 Feb 2012 15:08:19 -0800 Subject: [PATCH] Fix path to specs. Now spec-suite runs. --- Classes/native_handler.mm | 2 +- spec/spec-suite.coffee | 4 ++-- src/stdlib/require.coffee | 19 ++++++++----------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Classes/native_handler.mm b/Classes/native_handler.mm index 2469a5f19..0cec960b5 100644 --- a/Classes/native_handler.mm +++ b/Classes/native_handler.mm @@ -79,7 +79,7 @@ bool NativeHandler::Execute(const CefString& name, retval = CefV8Value::CreateArray(); for (NSUInteger i = 0; i < relativePaths.count; i++) { NSString *relativePath = [relativePaths objectAtIndex:i]; - NSString *fullPath = [path stringByAppendingString:relativePath]; + NSString *fullPath = [path stringByAppendingPathComponent:relativePath]; retval->SetValue(i, CefV8Value::CreateString([fullPath UTF8String])); } } diff --git a/spec/spec-suite.coffee b/spec/spec-suite.coffee index e9418eb54..08524f51c 100644 --- a/spec/spec-suite.coffee +++ b/spec/spec-suite.coffee @@ -1,4 +1,4 @@ fs = require 'fs' - require 'spec-helper' -require path for path in fs.listDirectoryTree(require.resolve '.') when /-spec\.coffee$/.test path + +require path for path in fs.listDirectoryTree($atom.loadPath + "/spec") when /-spec\.coffee$/.test path diff --git a/src/stdlib/require.coffee b/src/stdlib/require.coffee index 9397f19cf..83f8a22f4 100644 --- a/src/stdlib/require.coffee +++ b/src/stdlib/require.coffee @@ -1,13 +1,11 @@ -resourcePath = $atom.loadPath - paths = [ - "#{resourcePath}/spec" - "#{resourcePath}/src/stdlib" - "#{resourcePath}/src/atom" - "#{resourcePath}/src" - "#{resourcePath}/extensions" - "#{resourcePath}/vendor" - "#{resourcePath}/static" + "#{$atom.loadPath}/spec" + "#{$atom.loadPath}/src/stdlib" + "#{$atom.loadPath}/src/atom" + "#{$atom.loadPath}/src" + "#{$atom.loadPath}/extensions" + "#{$atom.loadPath}/vendor" + "#{$atom.loadPath}/static" ] window.__filename = null @@ -73,7 +71,7 @@ resolve = (file) -> file = file.replace '../', "#{prefix}/" if file[0] isnt '/' - require.paths.some (path) -> + paths.some (path) -> fileExists = /\.(.+)$/.test(file) and __exists "#{path}/#{file}" jsFileExists = not /\.(.+)$/.test(file) and __exists "#{path}/#{file}.js" @@ -121,7 +119,6 @@ this.require = require this.nakedLoad = nakedLoad this.define = define -this.require.resourcePath = resourcePath this.require.paths = paths this.require.exts = exts