fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6859] added method getAbsolutePathOfVfsFile, and mad


From: Petur Thorsteinsson
Subject: [Fmsystem-commits] [6859] added method getAbsolutePathOfVfsFile, and made debug code better
Date: Thu, 27 Jan 2011 08:31:25 +0000

Revision: 6859
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6859
Author:   peturbjorn
Date:     2011-01-27 08:31:25 +0000 (Thu, 27 Jan 2011)
Log Message:
-----------
added method getAbsolutePathOfVfsFile, and made debug code better

Modified Paths:
--------------
    branches/dev-bim2/property/inc/class.sovfs.inc.php

Modified: branches/dev-bim2/property/inc/class.sovfs.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.sovfs.inc.php  2011-01-27 08:29:56 UTC 
(rev 6858)
+++ branches/dev-bim2/property/inc/class.sovfs.inc.php  2011-01-27 08:31:25 UTC 
(rev 6859)
@@ -16,6 +16,11 @@
                public function setFilename($filename);
                public function setFileNameWithFullPath($fileNameWithFullPath);
                /*
+                * Arguments that needed to be set: Filename and Submodule
+                * @return the absolute file name and path of the VFS file in 
the current filesystem
+                */
+               public function getAbsolutePathOfVfsFile();
+               /*
                 * Submodule is in effect the subdirectory under /property that 
the file is put into
                 */
                public function setSubModule($subModule);
@@ -37,6 +42,20 @@
                        $this->subModule = $subModule;
                }
                /*
+                * Required fields: filename and submodule
+                */
+               public function getAbsolutePathOfVfsFile() {
+                       if(empty($this->filename)) {
+                               throw new Exception("Missing filename");
+                       }
+                       $vfsFilenameWithPath = 
$this->createResultingFileName($this->subModule, $this->filename);
+                       $pathInfo = ($this->bofiles->vfs->path_parts(array(
+                                                                               
'string'        => $vfsFilenameWithPath,
+                                                                               
'mask'  => array (RELATIVE_NONE),
+                                                                               
'fake'  => false )));
+                       return $pathInfo->real_full_path;
+               }
+               /*
                 * code derived from class.uitts.inc.php, from the part where 
it says '//------------ files'
                 * This method will save files under the 'property' folder in 
the vfs structure
                 * @return The filename that was added
@@ -46,13 +65,13 @@
                 */
                public function addFileToVfs() {
                        if(!$this->filename || !$this->fileNameWithFullPath) {
-                               $errorString = "Illegal arguments";
+                               $errorString = "\nIllegal arguments\n";
                                $errorString = 
$errorString."filename:$this->filename \n";
                                $errorString = 
$errorString."fileNameWithFullPath:$this->fileNameWithFullPath \n";
                                throw new Exception($errorString);
                        }
                        if($this->debug) {
-                               echo "Starting add file to VFS with following 
arguments:";
+                               echo "Starting add file to VFS with following 
arguments:\n";
                                echo "filename: \t $this->filename \n";
                                echo "filename with full path:\t 
$this->fileNameWithFullPath \n";
                                echo "subModule: $this->subModule \n";
@@ -61,6 +80,10 @@
                        $filename = 
$this->convertSpacesToUnderscores($this->filename);
                        $to_file = 
$this->createResultingFileName($this->subModule, $this->filename);
                        
+                       if($this->debug) {
+                               echo "Altered filename:\t $filename \n".
+                                       "The TO-FILE:\t $to_file \n";
+                       }
                        
                        try {
                                if($this->checkIfFileExists()) {
@@ -84,11 +107,17 @@
                        return $filename;
                }
                private function copyFileToVfs($sourceFile, $destinationFile) {
-                       try {
-                               $this->bofiles->vfs->cp2(array (
+                       
+                       $inputArray = array (
                                'from'  => $sourceFile,
                                'to'    => $destinationFile,
-                               'relatives'     => array 
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)));
+                               'relatives'     => array 
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
+                       if($this->debug) {
+                               echo "InputArray\n";
+                               print_r($inputArray);
+                       }
+                       try {
+                               $this->bofiles->vfs->cp2($inputArray);
                        } catch ( Exception $e) {
                                throw $e;
                        }
@@ -122,6 +151,7 @@
                
                public function getFileFromVfs() {
                        
+                       
                }
                /*
                 * Needs the filename set, and the submodule ( if applicable)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]