Skip to content

Commit

Permalink
handle parsing files not in the current working directory that have p…
Browse files Browse the repository at this point in the history
…roto imports within the same directory
  • Loading branch information
Christopher Mancini committed May 11, 2016
1 parent e8686ec commit ec72927
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ProtobufCompiler/ProtobufParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,8 @@ private function _parseMessageType(
);
}

$includedFilename = $matches[1][0];

// use dirname to get absolute path in case file parsed is not in cwd
$includedFilename = dirname($file->getName()) . DIRECTORY_SEPARATOR . $matches[1][0];
if (!file_exists($includedFilename)) {
throw new Exception(
'Included file ' . $includedFilename . ' does not exist'
Expand Down Expand Up @@ -1151,8 +1151,7 @@ private function _resolveMessageFieldTypes(
continue;
}

$exists = $this->_namespaces[$file->getPackage()]
[$field->getType()];
$exists = $this->_namespaces[$file->getPackage()][$field->getType()];

if (isset($exists)) {

Expand Down

0 comments on commit ec72927

Please sign in to comment.