OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Refine .bat fix for escaped closing quote (#33987)
Vladimir Zlobinc2459fc4b75a
diff --git a/samples/cpp/build_samples_msvc.bat b/samples/cpp/build_samples_msvc.batindex fb41f7bd569..9f09bdd88f8 100644--- a/samples/cpp/build_samples_msvc.bat+++ b/samples/cpp/build_samples_msvc.bat@@ -5,8 +5,10 @@@setlocalSETLOCAL EnableDelayedExpansion-set "SAMPLES_SOURCE_DIR=%~dp0"-FOR %%i IN ("%SAMPLES_SOURCE_DIR%\.") DO set SAMPLES_TYPE=%%~nxi+@REM %~dp0 ends with a backslash which escapes+@REM the closing quote in "%SAMPLES_SOURCE_DIR%". Append a dot to prevent this.+set "SAMPLES_SOURCE_DIR=%~dp0."+FOR %%i IN ("%SAMPLES_SOURCE_DIR%") DO set SAMPLES_TYPE=%%~nxiset "SAMPLES_BUILD_DIR=%USERPROFILE%\Documents\Intel\OpenVINO\openvino_%SAMPLES_TYPE%_samples_build"set SAMPLES_INSTALL_DIR=@@ -43,15 +45,7 @@ if "%INTEL_OPENVINO_DIR%"=="" (if exist "%SAMPLES_BUILD_DIR%\CMakeCache.txt" del "%SAMPLES_BUILD_DIR%\CMakeCache.txt"-@REM %SAMPLES_SOURCE_DIR% ends with a backslash. \ escapes-@REM the closing quote in "%SAMPLES_SOURCE_DIR%", causing CMake 4.0+ to treat the-@REM escaped quote as a literal character and produce an invalid path.-@REM Appending \. prevents the trailing \ from escaping the quote, while still-@REM referring to the same directory. Without this, CMake reports the error:-@REM CMake Error: The source directory "<prefix>/samples/cpp"" does not exist.-@REM-@REM Note: `cmake --build "%SAMPLES_BUILD_DIR%"` does not suffer from this issue.-cd /d "%SAMPLES_SOURCE_DIR%" && cmake -E make_directory "%SAMPLES_BUILD_DIR%" && cd /d "%SAMPLES_BUILD_DIR%" && cmake -DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON "%SAMPLES_SOURCE_DIR%\."+cd /d "%SAMPLES_SOURCE_DIR%" && cmake -E make_directory "%SAMPLES_BUILD_DIR%" && cd /d "%SAMPLES_BUILD_DIR%" && cmake -DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON "%SAMPLES_SOURCE_DIR%"if ERRORLEVEL 1 GOTO errorHandlingecho.