30 lines
745 B
Batchfile
30 lines
745 B
Batchfile
|
:: 修改后的脚本(主要调整OUT_PATH部分)
|
|||
|
cd ./proto/
|
|||
|
del ..\protoGen\Proto\*.proto
|
|||
|
copy *.proto ..\protoGen\Proto\
|
|||
|
|
|||
|
cd ..\protoGen
|
|||
|
|
|||
|
del .\ProtoOut\*.cs
|
|||
|
|
|||
|
dir .\Proto\*.proto /b > protolist.txt
|
|||
|
for /f "delims=." %%i in (protolist.txt) do (
|
|||
|
if not "%%i"=="client_msg" if not "%%i"=="client_msg_enum" (
|
|||
|
protogen -i:./Proto/%%i.proto -o:./ProtoOut/%%i.cs -ns:CusProtobuf -p:detectMissing
|
|||
|
)
|
|||
|
)
|
|||
|
|
|||
|
cd ./ProtoOut
|
|||
|
:: 关键修改:计算相对路径(假设脚本根目录为 F:\lingsuan\main\protobuf)
|
|||
|
set OUT_PATH=..\..\..\%protobuf_server
|
|||
|
|
|||
|
:: 确保目标目录存在
|
|||
|
if not exist "%OUT_PATH%" mkdir "%OUT_PATH%"
|
|||
|
|
|||
|
copy *.cs %OUT_PATH%
|
|||
|
del ..\..\protolist.txt
|
|||
|
|
|||
|
:: 打开导出的目录文件夹
|
|||
|
start "" "%OUT_PATH%"
|
|||
|
|
|||
|
exit
|