Use fs.realpathSync instead of something hacky.

This commit is contained in:
Jeremy Ashkenas 2010-08-08 10:05:44 -04:00
parent 08506f160d
commit a749d43897
2 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,5 @@
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, _a, _b, _c, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, localPath, optionParser, options, optparse, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs;
var BANNER, CoffeeScript, EventEmitter, SWITCHES, _a, _b, _c, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, options, optparse, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs;
fs = require('fs');
path = require('path');
optparse = require('./optparse');
@ -18,7 +18,6 @@
options = {};
sources = [];
optionParser = null;
localPath = /^.\//;
exports.run = function() {
var flags, separator;
parseOptions();
@ -103,7 +102,7 @@
_e = o.require;
for (_d = 0, _f = _e.length; _d < _f; _d++) {
file = _e[_d];
require(file.replace(localPath, process.cwd() + '/'));
require(fs.realpathSync(file));
}
}
try {

View File

@ -47,7 +47,6 @@ SWITCHES = [
options = {}
sources = []
optionParser = null
localPath = /^.\//
# Run `coffee` by parsing passed options and determining what action to take.
# Many flags cause us to divert before compiling anything. Flags passed after
@ -97,7 +96,7 @@ compileScript = (source, code, base) ->
o = options
codeOpts = compileOptions source
if o.require
require file.replace(localPath, process.cwd() + '/') for file in o.require
require fs.realpathSync file for file in o.require
try
CoffeeScript.emit 'compile', {source, code, base, options}
if o.tokens then printTokens CoffeeScript.tokens code