-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from m-tmatma/feature/use-predefined-program-…
…files-env Program Files や Program Files (x86) のパスを決め打ちせずに環境変数を参照する
- Loading branch information
Showing
16 changed files
with
318 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
set HHC=C:\Program Files (x86)\HTML Help Workshop\hhc.exe | ||
call %~dp0tools\hhc\find-hhc.bat | ||
if "%CMD_HHC%" == "" ( | ||
echo hhc.exe was not found. | ||
exit /b 1 | ||
) | ||
|
||
@rem hhc.exe returns 1 on success, and returns 0 on failure | ||
"%HHC%" help\macro\macro.HHP | ||
"%CMD_HHC%" help\macro\macro.HHP | ||
if %errorlevel% equ 0 (echo error && exit /b 1) | ||
|
||
"%HHC%" help\plugin\plugin.hhp | ||
"%CMD_HHC%" help\plugin\plugin.hhp | ||
if %errorlevel% equ 0 (echo error && exit /b 1) | ||
|
||
"%HHC%" help\sakura\sakura.hhp | ||
"%CMD_HHC%" help\sakura\sakura.hhp | ||
if %errorlevel% equ 0 (echo error && exit /b 1) | ||
|
||
exit /b 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@rem see readme.md | ||
@echo off | ||
set CMD_CPPCHECK= | ||
set PATH_CPPCHECK_1= | ||
set PATH_CPPCHECK_2= | ||
set PATH_CPPCHECK_3= | ||
|
||
if not "%ProgramFiles%" == "" set "PATH_CPPCHECK_1=%ProgramFiles%\Cppcheck\cppcheck.exe" | ||
if not "%ProgramFiles(x86)%" == "" set "PATH_CPPCHECK_2=%ProgramFiles(x86)%\Cppcheck\cppcheck.exe" | ||
if not "%ProgramW6432%" == "" set "PATH_CPPCHECK_3=%ProgramW6432%\Cppcheck\cppcheck.exe" | ||
|
||
set RESULT_PATH_CPPCHECK_1=-- | ||
set RESULT_PATH_CPPCHECK_2=-- | ||
set RESULT_PATH_CPPCHECK_3=-- | ||
|
||
if exist "%PATH_CPPCHECK_1%" ( | ||
set RESULT_PATH_CPPCHECK_1=OK | ||
set "CMD_CPPCHECK=%PATH_CPPCHECK_1%" | ||
) else if exist "%PATH_CPPCHECK_2%" ( | ||
set RESULT_PATH_CPPCHECK_2=OK | ||
set "CMD_CPPCHECK=%PATH_CPPCHECK_2%" | ||
) else if exist "%PATH_CPPCHECK_3%" ( | ||
set RESULT_PATH_CPPCHECK_3=OK | ||
set "CMD_CPPCHECK=%PATH_CPPCHECK_3%" | ||
) | ||
|
||
@echo %RESULT_PATH_CPPCHECK_1% %PATH_CPPCHECK_1% | ||
@echo %RESULT_PATH_CPPCHECK_2% %PATH_CPPCHECK_2% | ||
@echo %RESULT_PATH_CPPCHECK_3% %PATH_CPPCHECK_3% | ||
@echo. | ||
@echo CMD_CPPCHECK "%CMD_CPPCHECK%" | ||
@echo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- TOC --> | ||
|
||
- [cppcheck のパスを見つけるバッチファイル](#cppcheck-のパスを見つけるバッチファイル) | ||
- [ロジック](#ロジック) | ||
- [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) | ||
|
||
<!-- /TOC --> | ||
|
||
# cppcheck のパスを見つけるバッチファイル | ||
|
||
cppcheck.exe のパスを見つけて 環境変数 `CMD_CPPCHECK` に設定する | ||
|
||
## ロジック | ||
|
||
以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_CPPCHECK` にセットする。 | ||
|
||
- %ProgramFiles%\Cppcheck\cppcheck.exe | ||
- %ProgramFiles(x86)%\Cppcheck\cppcheck.exe | ||
- %ProgramW6432%\Cppcheck\cppcheck.exe | ||
|
||
## バッチファイルでのはまりポイント | ||
|
||
[hhc.exe の readme](../hhc/readme.md) を参照 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@rem see readme.md | ||
@echo off | ||
set CMD_ISCC= | ||
set PATH_ISCC_1= | ||
set PATH_ISCC_2= | ||
set PATH_ISCC_3= | ||
|
||
if not "%ProgramFiles%" == "" set "PATH_ISCC_1=%ProgramFiles%\Inno Setup 5\ISCC.exe" | ||
if not "%ProgramFiles(x86)%" == "" set "PATH_ISCC_2=%ProgramFiles(x86)%\Inno Setup 5\ISCC.exe" | ||
if not "%ProgramW6432%" == "" set "PATH_ISCC_3=%ProgramW6432%\Inno Setup 5\ISCC.exe" | ||
|
||
set RESULT_PATH_ISCC_1=-- | ||
set RESULT_PATH_ISCC_2=-- | ||
set RESULT_PATH_ISCC_3=-- | ||
|
||
if exist "%PATH_ISCC_1%" ( | ||
set RESULT_PATH_ISCC_1=OK | ||
set "CMD_ISCC=%PATH_ISCC_1%" | ||
) else if exist "%PATH_ISCC_2%" ( | ||
set RESULT_PATH_ISCC_2=OK | ||
set "CMD_ISCC=%PATH_ISCC_2%" | ||
) else if exist "%PATH_ISCC_3%" ( | ||
set RESULT_PATH_ISCC_3=OK | ||
set "CMD_ISCC=%PATH_ISCC_3%" | ||
) | ||
|
||
@echo %RESULT_PATH_ISCC_1% %PATH_ISCC_1% | ||
@echo %RESULT_PATH_ISCC_2% %PATH_ISCC_2% | ||
@echo %RESULT_PATH_ISCC_3% %PATH_ISCC_3% | ||
@echo. | ||
@echo CMD_ISCC "%CMD_ISCC%" | ||
@echo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- TOC --> | ||
|
||
- [Inno Setup Compiler のパスを見つけるバッチファイル](#inno-setup-compiler-のパスを見つけるバッチファイル) | ||
- [ロジック](#ロジック) | ||
- [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) | ||
|
||
<!-- /TOC --> | ||
|
||
# Inno Setup Compiler のパスを見つけるバッチファイル | ||
|
||
ISCC.exe のパスを見つけて 環境変数 `CMD_ISCC` に設定する | ||
|
||
## ロジック | ||
|
||
以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_ISCC` にセットする。 | ||
|
||
- %ProgramFiles%\Inno Setup 5\ISCC.exe | ||
- %ProgramFiles(x86)%\Inno Setup 5\ISCC.exe | ||
- %ProgramW6432%\Inno Setup 5\ISCC.exe | ||
|
||
## バッチファイルでのはまりポイント | ||
|
||
[hhc.exe の readme](../hhc/readme.md) を参照 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@rem see readme.md | ||
@echo off | ||
set CMD_HHC= | ||
set PATH_HHC_1= | ||
set PATH_HHC_2= | ||
set PATH_HHC_3= | ||
|
||
if not "%ProgramFiles%" == "" set "PATH_HHC_1=%ProgramFiles%\HTML Help Workshop\hhc.exe" | ||
if not "%ProgramFiles(x86)%" == "" set "PATH_HHC_2=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe" | ||
if not "%ProgramW6432%" == "" set "PATH_HHC_3=%ProgramW6432%\HTML Help Workshop\hhc.exe" | ||
|
||
set RESULT_PATH_HHC_1=-- | ||
set RESULT_PATH_HHC_2=-- | ||
set RESULT_PATH_HHC_3=-- | ||
|
||
if exist "%PATH_HHC_1%" ( | ||
set RESULT_PATH_HHC_1=OK | ||
set "CMD_HHC=%PATH_HHC_1%" | ||
) else if exist "%PATH_HHC_2%" ( | ||
set RESULT_PATH_HHC_2=OK | ||
set "CMD_HHC=%PATH_HHC_2%" | ||
) else if exist "%PATH_HHC_3%" ( | ||
set RESULT_PATH_HHC_3=OK | ||
set "CMD_HHC=%PATH_HHC_3%" | ||
) | ||
|
||
@echo %RESULT_PATH_HHC_1% %PATH_HHC_1% | ||
@echo %RESULT_PATH_HHC_2% %PATH_HHC_2% | ||
@echo %RESULT_PATH_HHC_3% %PATH_HHC_3% | ||
@echo. | ||
@echo CMD_HHC "%CMD_HHC%" | ||
@echo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- TOC --> | ||
|
||
- [HTML Help Compiler のパスを見つけるバッチファイル](#html-help-compiler-のパスを見つけるバッチファイル) | ||
- [ロジック](#ロジック) | ||
- [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) | ||
|
||
<!-- /TOC --> | ||
|
||
# HTML Help Compiler のパスを見つけるバッチファイル | ||
|
||
hhc.exe のパスを見つけて 環境変数 `CMD_HHC` に設定する | ||
|
||
## ロジック | ||
|
||
以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_HHC` にセットする。 | ||
|
||
- %ProgramFiles%\HTML Help Workshop\hhc.exe | ||
- %ProgramFiles(x86)%\HTML Help Workshop\hhc.exe | ||
- %ProgramW6432%\HTML Help Workshop\hhc.exe | ||
|
||
## バッチファイルでのはまりポイント | ||
|
||
たとえば以下のようなバッチファイルでの記述の場合 | ||
|
||
``` | ||
if not "%ProgramFiles(x86)%" == "" set HHC_PATH2=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe | ||
if exist "%HHC_PATH2%" ( | ||
set CMD_HHC=%HHC_PATH2% | ||
) | ||
``` | ||
|
||
以下のような意味不明のエラーメッセージが出る | ||
|
||
``` | ||
\HTML の使い方が誤っています。 | ||
``` | ||
|
||
上記のバッチファイルは実行時に以下のような内容になる。 | ||
|
||
``` | ||
if exist "C:\Program Files (x86)\HTML Help Workshop\hhc.exe" ( | ||
set CMD_HHC=C:\Program Files (x86)\HTML Help Workshop\hhc.exe | ||
) | ||
``` | ||
|
||
if の構文の `(` が `C:\Program Files (x86)\HTML Help Workshop\hhc.exe` の `)` と対応すると | ||
解釈されるので `\HTML` が if の条件が成立したときのコマンドと認識されるのでエラーになる。 | ||
|
||
このエラーを回避するために以下のように、代入文の変数名 ~ 値の部分全体をダブルクオートで囲む。 | ||
|
||
``` | ||
if exist "%HHC_PATH2%" ( | ||
set "CMD_HHC=%HHC_PATH2%" | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@rem see readme.md | ||
@echo off | ||
set CMD_MSBUILD= | ||
set PATH_MSBUILD_1= | ||
set PATH_MSBUILD_2= | ||
set PATH_MSBUILD_3= | ||
|
||
if not "%ProgramFiles%" == "" set "PATH_MSBUILD_1=%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" | ||
if not "%ProgramFiles(x86)%" == "" set "PATH_MSBUILD_2=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" | ||
if not "%ProgramW6432%" == "" set "PATH_MSBUILD_3=%ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" | ||
|
||
set RESULT_PATH_MSBUILD_1=-- | ||
set RESULT_PATH_MSBUILD_2=-- | ||
set RESULT_PATH_MSBUILD_3=-- | ||
|
||
if exist "%PATH_MSBUILD_1%" ( | ||
set RESULT_PATH_MSBUILD_1=OK | ||
set "CMD_MSBUILD=%PATH_MSBUILD_1%" | ||
) else if exist "%PATH_MSBUILD_2%" ( | ||
set RESULT_PATH_MSBUILD_2=OK | ||
set "CMD_MSBUILD=%PATH_MSBUILD_2%" | ||
) else if exist "%PATH_MSBUILD_3%" ( | ||
set RESULT_PATH_MSBUILD_3=OK | ||
set "CMD_MSBUILD=%PATH_MSBUILD_3%" | ||
) | ||
|
||
@echo %RESULT_PATH_MSBUILD_1% %PATH_MSBUILD_1% | ||
@echo %RESULT_PATH_MSBUILD_2% %PATH_MSBUILD_2% | ||
@echo %RESULT_PATH_MSBUILD_3% %PATH_MSBUILD_3% | ||
@echo. | ||
@echo CMD_MSBUILD "%CMD_MSBUILD%" | ||
@echo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- TOC --> | ||
|
||
- [msbuild のパスを見つけるバッチファイル](#msbuild-のパスを見つけるバッチファイル) | ||
- [ロジック](#ロジック) | ||
- [バッチファイルでのはまりポイント](#バッチファイルでのはまりポイント) | ||
|
||
<!-- /TOC --> | ||
|
||
# msbuild のパスを見つけるバッチファイル | ||
|
||
msbuild.exe のパスを見つけて 環境変数 `CMD_MSBUILD` に設定する | ||
|
||
## ロジック | ||
|
||
以下の順番でパスを検索して、見つかったパスを環境変数 `CMD_MSBUILD` にセットする。 | ||
|
||
- %ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe | ||
- %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe | ||
- %ProgramW6432%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe | ||
|
||
## バッチファイルでのはまりポイント | ||
|
||
[hhc.exe の readme](../hhc/readme.md) を参照 |
Oops, something went wrong.