Fix imports for messages without packages

This commit is contained in:
Michael Lumish 2020-08-31 09:40:17 -07:00
parent 6389e92c8b
commit 2d1cb15dec
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ function getPath(to: Protobuf.Type | Protobuf.Enum | Protobuf.Service) {
function getPathToRoot(from: Protobuf.NamespaceBase) {
const depth = stripLeadingPeriod(from.fullName).split('.').length - 1;
if (depth === 0) {
return './';
}
let path = '';
for (let i = 0; i < depth; i++) {
path += '../';