Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
6bea9e25
Commit
6bea9e25
authored
Oct 10, 2012
by
csharptest
Committed by
rogerk
Oct 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 40: import doesn't work / proto_path does not work for command-line file names
parent
bf2a92c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
TestPreprocessing.cs
src/ProtoGen.Test/TestPreprocessing.cs
+1
-1
ProgramPreprocess.cs
src/ProtoGen/ProgramPreprocess.cs
+17
-2
No files found.
src/ProtoGen.Test/TestPreprocessing.cs
View file @
6bea9e25
...
...
@@ -567,7 +567,7 @@ message MyMessage {
}
//Seems the --proto_path or -I option is non-functional for me. Maybe others have luck?
[
Test
,
Ignore
(
"http://code.google.com/p/protobuf/issues/detail?id=40"
)
]
[
Test
]
public
void
TestProtoFileInDifferentDirectory
()
{
string
test
=
new
StackFrame
(
false
).
GetMethod
().
Name
;
...
...
src/ProtoGen/ProgramPreprocess.cs
View file @
6bea9e25
...
...
@@ -84,6 +84,15 @@ namespace Google.ProtocolBuffers.ProtoGen
return
0
;
}
string
pathRoot
=
Environment
.
CurrentDirectory
;
foreach
(
string
arg
in
args
)
{
if
(
arg
.
StartsWith
(
"--proto_path="
,
StringComparison
.
InvariantCultureIgnoreCase
))
{
pathRoot
=
arg
.
Substring
(
13
);
}
}
foreach
(
string
arg
in
args
)
{
if
(
arg
.
StartsWith
(
ProtocDirectoryArg
))
...
...
@@ -95,7 +104,7 @@ namespace Google.ProtocolBuffers.ProtoGen
{
protocArgs
.
Add
(
arg
);
}
else
if
(
File
.
Exists
(
arg
)
&&
else
if
(
(
File
.
Exists
(
arg
)
||
File
.
Exists
(
Path
.
Combine
(
pathRoot
,
arg
))
)
&&
StringComparer
.
OrdinalIgnoreCase
.
Equals
(
".proto"
,
Path
.
GetExtension
(
arg
)))
{
if
(
tempFile
==
null
)
...
...
@@ -105,7 +114,13 @@ namespace Google.ProtocolBuffers.ProtoGen
protocArgs
.
Add
(
String
.
Format
(
"--descriptor_set_out={0}"
,
tempFile
));
protoGenArgs
.
Add
(
tempFile
);
}
protocArgs
.
Add
(
arg
);
string
patharg
=
arg
;
if
(!
File
.
Exists
(
patharg
))
{
patharg
=
Path
.
Combine
(
pathRoot
,
arg
);
}
protocArgs
.
Add
(
patharg
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment