xref: /aosp_15_r20/sdk/files/post_tools_install.bat (revision 1789df15502f1991eff51ff970dce5df8404dd56)
1*1789df15SXin Li@echo off
2*1789df15SXin Lirem Copyright (C) 2010 The Android Open Source Project
3*1789df15SXin Lirem
4*1789df15SXin Lirem Licensed under the Apache License, Version 2.0 (the "License");
5*1789df15SXin Lirem you may not use this file except in compliance with the License.
6*1789df15SXin Lirem You may obtain a copy of the License at
7*1789df15SXin Lirem
8*1789df15SXin Lirem      http://www.apache.org/licenses/LICENSE-2.0
9*1789df15SXin Lirem
10*1789df15SXin Lirem Unless required by applicable law or agreed to in writing, software
11*1789df15SXin Lirem distributed under the License is distributed on an "AS IS" BASIS,
12*1789df15SXin Lirem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*1789df15SXin Lirem See the License for the specific language governing permissions and
14*1789df15SXin Lirem limitations under the License.
15*1789df15SXin Li
16*1789df15SXin Lirem This script is called by the SDK Manager once a new version of the tools
17*1789df15SXin Lirem package as been installed.
18*1789df15SXin Li
19*1789df15SXin Lirem don't modify the caller's environment
20*1789df15SXin Lisetlocal
21*1789df15SXin Li
22*1789df15SXin Lirem Set up prog to be the path of this script, including following symlinks,
23*1789df15SXin Lirem and set up progdir to be the fully-qualified pathname of its directory.
24*1789df15SXin Liset prog=%~f0
25*1789df15SXin Li
26*1789df15SXin Lirem Grab current directory before we change it
27*1789df15SXin Liset work_dir=%cd%
28*1789df15SXin Li
29*1789df15SXin Lirem Change current directory and drive to where the script is, to avoid
30*1789df15SXin Lirem issues with directories containing whitespaces.
31*1789df15SXin Licd /d %~dp0
32*1789df15SXin Li
33*1789df15SXin Li:Step1
34*1789df15SXin Liset src=SDK Manager.exe
35*1789df15SXin Liset dst=..\..\%src%
36*1789df15SXin Li
37*1789df15SXin Liif not exist "%src%" goto Step2
38*1789df15SXin Li  echo Updating %src%
39*1789df15SXin Li  copy /V /Y "%src%" "%dst%"
40*1789df15SXin Li
41*1789df15SXin Li:Step2
42*1789df15SXin Liset src=AVD Manager.exe
43*1789df15SXin Liset dst=..\..\%src%
44*1789df15SXin Li
45*1789df15SXin Liif not exist "%src%" goto Cleanup
46*1789df15SXin Li  echo Updating %src%
47*1789df15SXin Li  copy /V /Y "%src%" "%dst%"
48*1789df15SXin Li
49*1789df15SXin Li:Cleanup
50*1789df15SXin Liset old_dst=..\..\SDK Setup.exe
51*1789df15SXin Liif not exist "%old_dst%" goto :EOF
52*1789df15SXin Li  echo Removing obsolete %old_dst%
53*1789df15SXin Li  del /F /Q "%old_dst%"
54