Rewritten:
[core.git] / framework / main / classes / class_BaseFrameworkSystem.php
index 56fd139686edb539d67e7bc28b8b289a61fc8922..cc2a0d4498982baf8c96835228947e3ae33e4f82 100644 (file)
@@ -52,6 +52,7 @@ use CoreFramework\Visitor\Visitor;
 use \stdClass;
 use \Iterator;
 use \ReflectionClass;
+use \SplFileInfo;
 
 /**
  * The simulator system class is the super class of all other classes. This
@@ -3277,32 +3278,32 @@ Loaded includes:
         * Creates a full-qualified file name (FQFN) for given file name by adding
         * a configured temporary file path to it.
         *
-        * @param       $fileName       Name for temporary file
-        * @return      $fqfn   Full-qualified file name
+        * @param       $infoInstance   An instance of a SplFileInfo class
+        * @return      $tempInstance   An instance of a SplFileInfo class (temporary file)
         * @throw       PathWriteProtectedException If the path in 'temp_file_path' is write-protected
         * @throws      FileIoException If the file cannot be written
         */
-        protected static function createTempPathForFile ($fileName) {
+        protected static function createTempPathForFile (SplFileInfo $infoInstance) {
                // Get config entry
                $basePath = FrameworkConfiguration::getSelfInstance()->getConfigEntry('temp_file_path');
 
                // Is the path writeable?
                if (!is_writable($basePath)) {
                        // Path is write-protected
-                       throw new PathWriteProtectedException($fileName, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN);
+                       throw new PathWriteProtectedException($infoInstance, self::EXCEPTION_PATH_CANNOT_BE_WRITTEN);
                } // END - if
 
                // Add it
-               $fqfn = $basePath . DIRECTORY_SEPARATOR . $fileName;
+               $tempInstance = new SplFileInfo($basePath . DIRECTORY_SEPARATOR . $infoInstance->getBasename());
 
                // Is it reachable?
-               if (!FrameworkBootstrap::isReachableFilePath($fqfn)) {
+               if (!FrameworkBootstrap::isReachableFilePath($tempInstance)) {
                        // Not reachable
-                       throw new FileIoException($fqfn, self::EXCEPTION_FILE_NOT_REACHABLE);
+                       throw new FileIoException($tempInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
                } // END - if
 
                // Return it
-               return $fqfn;
+               return $tempInstance;
         }
 
        /**