DXGL r210 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r209‎ | r210 | r211 >
Date:00:32, 10 July 2012
Author:admin
Status:new
Tags:
Comment:
Add help file to build process.
Modified paths:
  • /Help/Help.vcxproj (modified) (history)
  • /buildtool/buildtool.cpp (modified) (history)

Diff [purge]

Index: Help/Help.vcxproj
@@ -45,6 +45,12 @@
4646 <Link>
4747 <GenerateDebugInformation>true</GenerateDebugInformation>
4848 </Link>
 49+ <PostBuildEvent>
 50+ <Command>$(OutDir)buildtool.exe makehelp $(ProjectDir)dxgl.hhp</Command>
 51+ </PostBuildEvent>
 52+ <PostBuildEvent>
 53+ <Message>Building help...</Message>
 54+ </PostBuildEvent>
4955 </ItemDefinitionGroup>
5056 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
5157 <ClCompile>
Index: buildtool/buildtool.cpp
@@ -66,7 +66,7 @@
6767 MB_YESNO|MB_ICONWARNING);
6868 if(result == IDYES)
6969 {
70 - MessageBoxA(NULL,"Please try again after installing TortoiseSVN.","TortoiseSVN not found",MB_OK|MB_ICONINFORMATION);
 70+ cout << "ERROR: Please try again after installing TortoiseSVN." << endl;
7171 ShellExecuteA(NULL,"open","http://tortoisesvn.net/",NULL,NULL,SW_SHOWNORMAL);
7272 exit(-1);
7373 }
@@ -180,6 +180,51 @@
181181 return 0;
182182 }
183183
 184+int MakeHelp(char *path)
 185+{
 186+ HKEY hKey;
 187+ bool foundhhc = false;
 188+ char hhcpath[(MAX_PATH+1)*2];
 189+ DWORD buffersize = MAX_PATH+1;
 190+ if(RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\HTML Help Workshop",0,KEY_READ,&hKey) == ERROR_SUCCESS)
 191+ {
 192+ if(RegQueryValueExA(hKey,"InstallDir",NULL,NULL,(LPBYTE)hhcpath,&buffersize) == ERROR_SUCCESS)
 193+ {
 194+ strcat(hhcpath,"\\hhc.exe");
 195+ PROCESS_INFORMATION process;
 196+ STARTUPINFOA startinfo;
 197+ ZeroMemory(&startinfo,sizeof(STARTUPINFOA));
 198+ startinfo.cb = sizeof(STARTUPINFOA);
 199+ strcat(hhcpath," ");
 200+ strcat(hhcpath,path);
 201+ if(CreateProcessA(NULL,hhcpath,NULL,NULL,FALSE,0,NULL,NULL,&startinfo,&process))
 202+ {
 203+ foundhhc = true;
 204+ WaitForSingleObject(process.hProcess,INFINITE);
 205+ CloseHandle(process.hProcess);
 206+ CloseHandle(process.hThread);
 207+ }
 208+ }
 209+ RegCloseKey(hKey);
 210+ }
 211+ if(!foundhhc)
 212+ {
 213+ int result = MessageBoxA(NULL,"Could not find HTML Help Workshop, would you like to download it?","HTML Help Workshop not found",
 214+ MB_YESNO|MB_ICONERROR);
 215+ if(result == IDYES) ShellExecuteA(NULL,"open","http://tortoisesvn.net/",NULL,NULL,SW_SHOWNORMAL);
 216+ cout << "ERROR: HTML Help Compiler not found." << endl;
 217+ return -1;
 218+ }
 219+ return 0;
 220+}
 221+
 222+int MakeInstaller(char *path)
 223+{
 224+ // Registry path: HKEY_LOCAL_MACHINE\SOFTWARE\NSIS\(Default)
 225+ return 0;
 226+}
 227+
 228+
184229 int main(int argc, char *argv[])
185230 {
186231
@@ -196,9 +241,26 @@
197242 cout << "ERROR: No working directory specified." << endl;
198243 return 1;
199244 }
200 - ProcessHeaders(argv[2]);
201 - return 0;
 245+ return ProcessHeaders(argv[2]);
202246 }
 247+ if(!strcmp(argv[1],"makehelp"))
 248+ {
 249+ if(argc < 3)
 250+ {
 251+ cout << "ERROR: No working directory specified." << endl;
 252+ return 1;
 253+ }
 254+ return MakeHelp(argv[2]);
 255+ }
 256+ if(!strcmp(argv[1],"makeinstaller"))
 257+ {
 258+ if(argc < 3)
 259+ {
 260+ cout << "ERROR: No working directory specified." << endl;
 261+ return 1;
 262+ }
 263+ return MakeInstaller(argv[2]);
 264+ }
203265 }
204266 else
205267 {