77using System . Reflection ;
88using System . Text . RegularExpressions ;
99using CppSharp ;
10+ using CppSharp . Utils ;
1011
1112namespace QtSharp . CLI
1213{
@@ -88,18 +89,19 @@ static bool QueryQt(QtInfo qt, bool debug)
8889 path = Path . GetDirectoryName ( qt . Make ) + Path . PathSeparator + path ;
8990 Environment . SetEnvironmentVariable ( "Path" , path , EnvironmentVariableTarget . Process ) ;
9091
91- string error ;
92- qt . Bins = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_BINS" , out error ) ;
93- if ( ! string . IsNullOrEmpty ( error ) )
92+ int error ;
93+ string errorMessage ;
94+ qt . Bins = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_BINS" , out error , out errorMessage ) ;
95+ if ( ! string . IsNullOrEmpty ( errorMessage ) )
9496 {
95- Console . WriteLine ( error ) ;
97+ Console . WriteLine ( errorMessage ) ;
9698 return false ;
9799 }
98100
99- qt . Libs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_LIBS" , out error ) ;
100- if ( ! string . IsNullOrEmpty ( error ) )
101+ qt . Libs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_LIBS" , out error , out errorMessage ) ;
102+ if ( ! string . IsNullOrEmpty ( errorMessage ) )
101103 {
102- Console . WriteLine ( error ) ;
104+ Console . WriteLine ( errorMessage ) ;
103105 return false ;
104106 }
105107
@@ -112,10 +114,10 @@ static bool QueryQt(QtInfo qt, bool debug)
112114 return false ;
113115 }
114116 qt . LibFiles = GetLibFiles ( libsInfo , debug ) ;
115- qt . Headers = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_HEADERS" , out error ) ;
116- if ( ! string . IsNullOrEmpty ( error ) )
117+ qt . Headers = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_HEADERS" , out error , out errorMessage ) ;
118+ if ( ! string . IsNullOrEmpty ( errorMessage ) )
117119 {
118- Console . WriteLine ( error ) ;
120+ Console . WriteLine ( errorMessage ) ;
119121 return false ;
120122 }
121123 DirectoryInfo headersInfo = new DirectoryInfo ( qt . Headers ) ;
@@ -126,11 +128,11 @@ static bool QueryQt(QtInfo qt, bool debug)
126128 headersInfo . Name ) ;
127129 return false ;
128130 }
129- qt . Docs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_DOCS" , out error ) ;
131+ qt . Docs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_DOCS" , out error , out errorMessage ) ;
130132
131133 string emptyFile = Platform . IsWindows ? "NUL" : "/dev/null" ;
132134 string output ;
133- ProcessHelper . Run ( "gcc" , string . Format ( "-v -E -x c++ {0 }" , emptyFile ) , out output ) ;
135+ ProcessHelper . Run ( "gcc" , $ "-v -E -x c++ { emptyFile } ", out error , out output ) ;
134136 qt . Target = Regex . Match ( output , @"Target:\s*(?<target>[^\r\n]+)" ) . Groups [ "target" ] . Value ;
135137
136138 const string includeDirsRegex = @"#include <\.\.\.> search starts here:(?<includes>.+)End of search list" ;
@@ -150,24 +152,6 @@ static bool QueryQt(QtInfo qt, bool debug)
150152 return true ;
151153 }
152154
153- static void ProcessGeneratedInlines ( )
154- {
155- if ( ! Platform . IsWindows )
156- return ;
157-
158- #if DEBUG
159- if ( File . Exists ( "../../../QtSharp.Tests/bin/Debug/QtCore-inlines.dll" ) )
160- File . Delete ( "../../../QtSharp.Tests/bin/Debug/QtCore-inlines.dll" ) ;
161-
162- File . Copy ( "release/QtCore-inlines.dll" , "../../../QtSharp.Tests/bin/Debug/QtCore-inlines.dll" ) ;
163- #else
164- if ( File . Exists ( "../../../QtSharp.Tests/bin/Release/QtCore-inlines.dll" ) )
165- File . Delete ( "../../../QtSharp.Tests/bin/Release/QtCore-inlines.dll" ) ;
166-
167- File . Copy ( "release/QtCore-inlines.dll" , "../../../QtSharp.Tests/bin/Release/QtCore-inlines.dll" ) ;
168- #endif
169- }
170-
171155 public static int Main ( string [ ] args )
172156 {
173157 Stopwatch s = Stopwatch . StartNew ( ) ;
@@ -213,8 +197,6 @@ public static int Main(string[] args)
213197 ConsoleDriver . Run ( qtSharp ) ;
214198 var wrappedModules = qtSharp . GetVerifiedWrappedModules ( ) ;
215199
216- ProcessGeneratedInlines ( ) ;
217-
218200 if ( wrappedModules . Count == 0 )
219201 {
220202 Console . WriteLine ( "Generation failed." ) ;
0 commit comments