incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [3/3] docs commit: Don't resolve symlinks in paths.
Date Tue, 16 Oct 2012 02:08:56 GMT
Don't resolve symlinks in paths.

This works around a bug in my setup where a parent directory is a
symlink to a directory that has a space in it, and our script not
supporting paths with spaces in them. So yeah, hiding the real bug.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/8220d81b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/8220d81b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/8220d81b

Branch: refs/heads/master
Commit: 8220d81b51cffa562edb6ffcc1db446468a6fd9d
Parents: e696499
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Oct 15 22:06:17 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Oct 15 22:08:31 2012 -0400

----------------------------------------------------------------------
 lib/file_helpers.rb |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/8220d81b/lib/file_helpers.rb
----------------------------------------------------------------------
diff --git a/lib/file_helpers.rb b/lib/file_helpers.rb
index e3eb481..a703466 100644
--- a/lib/file_helpers.rb
+++ b/lib/file_helpers.rb
@@ -16,6 +16,7 @@
 # under the License.
 
 require 'fileutils'
+require 'pathname'
 
 module FileHelpers
   #
@@ -73,6 +74,11 @@ module FileHelpers
   private
   
   def root_directory
-    File.expand_path(File.join(File.dirname(__FILE__), '..'))
+    if Pathname.new(__FILE__).absolute?
+      return File.join(File.dirname(__FILE__), '..')
+    end
+    # Pathname.pwd resolves symlinks, which can introduce spaces in paths.
+    # Use CWD instead.
+    File.join(ENV['PWD'], File.dirname(__FILE__), '..')
   end
 end


Mime
View raw message