geoinfo_eGov_work/open_builded.bat

65 lines
2.1 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
rem # ----------------------------------------------------------------------
rem # 환경 설정: path.txt에서 이클립스 경로를 읽고 워크스페이스 경로를 설정합니다.
rem # ----------------------------------------------------------------------
rem # target_directory를 현재 배치 파일이 실행되는 경로로 설정합니다.
set "target_directory=%~dp0"
set "path_file=%target_directory%path.txt"
set "eclipse_path="
rem # path.txt 파일이 존재하는지 확인합니다.
if not exist "%path_file%" (
echo [ERROR] "%path_file%"을 찾을 수 없습니다. 스크립트를 종료합니다.
pause
exit /b
)
rem # path.txt에서 'eclipse='로 시작하는 라인을 찾아 이클립스 경로를 설정합니다.
for /f "tokens=1,* delims==" %%a in ('findstr /b "eclipse=" "%path_file%"') do (
set "eclipse_path=%%b"
)
if not defined eclipse_path (
echo [ERROR] "%path_file%"에서 이클립스 경로를 찾을 수 없습니다.
pause
exit /b
)
rem # 이클립스 설정 파일 경로를 만듭니다.
set "prefs_file=!eclipse_path!\configuration\.settings\org.eclipse.ui.ide.prefs"
if not exist "!prefs_file!" (
echo [ERROR] Eclipse 설정 파일을 찾을 수 없습니다: "!prefs_file!"
pause
exit /b
)
rem # 설정 파일에서 최근 워크스페이스 목록을 읽어옵니다.
for /f "tokens=1,* delims==" %%a in ('findstr /b "RECENT_WORKSPACES=" "!prefs_file!"') do (
set "workspaces_line=%%b"
)
rem # \n을 공백으로 치환하여 여러 경로가 있을 경우 첫 번째 경로만 가져옵니다.
set "workspaces_line_cleaned=!workspaces_line:\n= !"
for /f "tokens=1" %%w in ("!workspaces_line_cleaned!") do (
set "workspace_path=%%w"
)
rem # 경로에 포함된 이스케이프 문자(\\)를 단일 백슬래시(\)로 변경합니다.
set "workspace_path=!workspace_path:\\=\!"
rem # 드라이브 경로 형식이 'D\:\'와 같이 잘못된 경우 'D:\'로 바로잡습니다.
set "drive_letter=!workspace_path:~0,1!"
if /i "!workspace_path:~1,2!" == "\:" (
set "workspace_path=!drive_letter!:!workspace_path:~3!"
)
rem # 최종 target_prefix를 설정합니다.
set "target_prefix=!workspace_path!\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\geoinfo_eGov_work\"
explorer "!target_prefix!"
echo target_prefix: "!target_prefix!"