From a72469bab6bb3d5b59eb0d3ac075057c12e802d2 Mon Sep 17 00:00:00 2001 From: Shayne Sweeney Date: Wed, 28 Oct 2015 11:22:28 -0700 Subject: [PATCH] Fix inability to use symlinked config with relative includes My Phoenix config is symlinked to `~/.phoenix.js` from my dotfiles directory. This PR adds support for relative requires whether or not you're using a symlinked config file, it also maintains support for absoltue path includes (e.g. `require('~/jslibs/some-file.js')`). --- Phoenix/PHContext.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Phoenix/PHContext.m b/Phoenix/PHContext.m index b45fbdd1..60b26625 100644 --- a/Phoenix/PHContext.m +++ b/Phoenix/PHContext.m @@ -88,11 +88,11 @@ - (void) handleException:(id)exception { - (NSString *) resolvePath:(NSString *)path { - path = path.stringByStandardizingPath; + path = path.stringByResolvingSymlinksInPath; // Resolve path if(![path isAbsolutePath]) { - NSURL *relativeUrl = [NSURL URLWithString:PHConfigurationPath.stringByStandardizingPath]; + NSURL *relativeUrl = [NSURL URLWithString:PHConfigurationPath.stringByResolvingSymlinksInPath]; path = [NSURL URLWithString:path relativeToURL:relativeUrl].absoluteString; }