[horde] VFS "file" backend, relative paths and gollem's "change directory"

Liam Hoekenga liamr at umich.edu
Sun Dec 28 19:25:43 PST 2003


> Yes, but I'm not entirely sure how to go about it, or what people want out
> of it. If you updated your old patch, I'd try to take a look at it and see
how
> it fit.

It doesn't look like VFS/file.php's _getNativePath function has changed between
version 1.44 and the current version (1.50).  The attached patch was written for
v1.44, and was a working implimentation of non-tilde relative paths.  It
doesn't seem to work with 1.50.  I'm not sure why.

The patch appears at the end of this message.  
Our previous discussion on this subject can be found at:

http://search.gmane.org/search.php?query=relative+paths&email=&group=gmane.comp.horde.gollem&sort=date

Liam

-----------------------------------------------


--- /tmp/file.php       Sun Dec 28 22:09:23 2003
+++ file.php    Thu Aug 14 13:40:10 2003
@@ -10,5 +10,5 @@
  * directory you specific as the 'vfsroot'.
  *
- * $Horde: horde/lib/VFS/file.php,v 1.43 2003/07/14 00:40:56 chuck Exp $
+ * $Horde: horde/lib/VFS/file.php,v 1.44 2003/07/14 04:00:05 chuck Exp $
  *
  * Copyright 2002-2003 Chuck Hagenbuch <chuck at horde.org>
@@ -528,4 +528,17 @@
 
         if (!empty($path)) {
+          if (preg_match('|^~([^/]+)/?(.*)$|', $path, $matches)) {
+              $tmp = posix_getpwnam($matches[1]);
+              if (isset($tmp['dir'])) {
+                  $path = $tmp['dir'] . DIRECTORY_SEPARATOR .
+                          $matches[2];
+              }
+          }
+
+          if (preg_match('|^~/?(.*)$|', $path, $matches)) {
+              $path = $this->_params['home']  .
+                      DIRECTORY_SEPARATOR . $matches[1];
+          }
+
             $path = str_replace('..', '', $path);
             if (substr($path, 0, 1) == DIRECTORY_SEPARATOR) {



More information about the horde mailing list