original_string: public function getUploadDir($subdir = null)
      {
          $dir = GEMS_ROOT_DIR . '/var/uploads';
  
          if ($subdir) {
              if (($subdir[0] == '/') || ($subdir[0] == '\\') || (substr($subdir, 1, 2) == ':\\')) {
                  $dir = rtrim($subdir, '\//');
              } else {
                  $dir .= DIRECTORY_SEPARATOR . rtrim($subdir, '\//');
              }
          }
  
          if (! is_dir($dir)) {
              $oldmask = umask(0777);
              if (! @mkdir($dir, 0777, true)) {
                  $this->throwLastError(sprintf($this->translate->_("Could not create '%s' directory."), $dir));
              }
              umask($oldmask);
          }
  
          return $dir;
      }
code: public function getUploadDir($subdir = null)
      {
          $dir = GEMS_ROOT_DIR . '/var/uploads';
  
          if ($subdir) {
              if (($subdir[0] == '/') || ($subdir[0] == '\\') || (substr($subdir, 1, 2) == ':\\')) {
                  $dir = rtrim($subdir, '\//');
              } else {
                  $dir .= DIRECTORY_SEPARATOR . rtrim($subdir, '\//');
              }
          }
  
          if (! is_dir($dir)) {
              $oldmask = umask(0777);
              if (! @mkdir($dir, 0777, true)) {
                  $this->throwLastError(sprintf($this->translate->_("Could not create '%s' directory."), $dir));
              }
              umask($oldmask);
          }
  
          return $dir;
      }
code_tokens: public function getUploadDir ( $ subdir = null ) { $ dir = GEMS_ROOT_DIR . '/var/uploads' ; if ( $ subdir ) { if ( ( $ subdir [ 0 ] == '/' ) || ( $ subdir [ 0 ] == '\\' ) || ( substr ( $ subdir , 1 , 2 ) == ':\\' ) ) { $ dir = rtrim ( $ subdir , '\//' ) ; } else { $ dir .= DIRECTORY_SEPARATOR . rtrim ( $ subdir , '\//' ) ; } } if ( ! is_dir ( $ dir ) ) { $ oldmask = umask ( 0777 ) ; if ( ! @ mkdir ( $ dir , 0777 , true ) ) { $ this -> throwLastError ( sprintf ( $ this -> translate -> _ ( "Could not create '%s' directory." ) , $ dir ) ) ; } umask ( $ oldmask ) ; } return $ dir ; }
docstring: Return upload directory, optionally with specified sub directory.
  
  You can overrule this function to specify your own directory.
  
  @param string $subdir Optional sub-directory, when starting with / or x:\ only $subdir is used. Function creates subdirectory if it does not exist.
  @return string
docstring_tokens: Return upload directory optionally with specified sub directory .