1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.sdklib; 18 19 import com.android.AndroidConstants; 20 21 import java.io.File; 22 23 /** 24 * Constant definition class.<br> 25 * <br> 26 * Most constants have a prefix defining the content. 27 * <ul> 28 * <li><code>OS_</code> OS path constant. These paths are different depending on the platform.</li> 29 * <li><code>FN_</code> File name constant.</li> 30 * <li><code>FD_</code> Folder name constant.</li> 31 * </ul> 32 * 33 */ 34 public final class SdkConstants { 35 public final static int PLATFORM_UNKNOWN = 0; 36 public final static int PLATFORM_LINUX = 1; 37 public final static int PLATFORM_WINDOWS = 2; 38 public final static int PLATFORM_DARWIN = 3; 39 40 /** 41 * Returns current platform, one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN}, 42 * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}. 43 */ 44 public final static int CURRENT_PLATFORM = currentPlatform(); 45 46 /** 47 * Charset for the ini file handled by the SDK. 48 */ 49 public final static String INI_CHARSET = "UTF-8"; //$NON-NLS-1$ 50 51 /** An SDK Project's AndroidManifest.xml file */ 52 public static final String FN_ANDROID_MANIFEST_XML= "AndroidManifest.xml"; //$NON-NLS-1$ 53 /** pre-dex jar filename. i.e. "classes.jar" */ 54 public final static String FN_CLASSES_JAR = "classes.jar"; //$NON-NLS-1$ 55 /** Dex filename inside the APK. i.e. "classes.dex" */ 56 public final static String FN_APK_CLASSES_DEX = "classes.dex"; //$NON-NLS-1$ 57 58 /** An SDK Project's build.xml file */ 59 public final static String FN_BUILD_XML = "build.xml"; //$NON-NLS-1$ 60 61 /** Name of the framework library, i.e. "android.jar" */ 62 public static final String FN_FRAMEWORK_LIBRARY = "android.jar"; //$NON-NLS-1$ 63 /** Name of the layout attributes, i.e. "attrs.xml" */ 64 public static final String FN_ATTRS_XML = "attrs.xml"; //$NON-NLS-1$ 65 /** Name of the layout attributes, i.e. "attrs_manifest.xml" */ 66 public static final String FN_ATTRS_MANIFEST_XML = "attrs_manifest.xml"; //$NON-NLS-1$ 67 /** framework aidl import file */ 68 public static final String FN_FRAMEWORK_AIDL = "framework.aidl"; //$NON-NLS-1$ 69 /** framework renderscript folder */ 70 public static final String FN_FRAMEWORK_RENDERSCRIPT = "renderscript"; //$NON-NLS-1$ 71 /** framework include folder */ 72 public static final String FN_FRAMEWORK_INCLUDE = "include"; //$NON-NLS-1$ 73 /** framework include (clang) folder */ 74 public static final String FN_FRAMEWORK_INCLUDE_CLANG = "clang-include"; //$NON-NLS-1$ 75 /** layoutlib.jar file */ 76 public static final String FN_LAYOUTLIB_JAR = "layoutlib.jar"; //$NON-NLS-1$ 77 /** widget list file */ 78 public static final String FN_WIDGETS = "widgets.txt"; //$NON-NLS-1$ 79 /** Intent activity actions list file */ 80 public static final String FN_INTENT_ACTIONS_ACTIVITY = "activity_actions.txt"; //$NON-NLS-1$ 81 /** Intent broadcast actions list file */ 82 public static final String FN_INTENT_ACTIONS_BROADCAST = "broadcast_actions.txt"; //$NON-NLS-1$ 83 /** Intent service actions list file */ 84 public static final String FN_INTENT_ACTIONS_SERVICE = "service_actions.txt"; //$NON-NLS-1$ 85 /** Intent category list file */ 86 public static final String FN_INTENT_CATEGORIES = "categories.txt"; //$NON-NLS-1$ 87 88 /** platform build property file */ 89 public final static String FN_BUILD_PROP = "build.prop"; //$NON-NLS-1$ 90 /** plugin properties file */ 91 public final static String FN_PLUGIN_PROP = "plugin.prop"; //$NON-NLS-1$ 92 /** add-on manifest file */ 93 public final static String FN_MANIFEST_INI = "manifest.ini"; //$NON-NLS-1$ 94 /** add-on layout device XML file. */ 95 public final static String FN_DEVICES_XML = "devices.xml"; //$NON-NLS-1$ 96 /** hardware properties definition file */ 97 public final static String FN_HARDWARE_INI = "hardware-properties.ini"; //$NON-NLS-1$ 98 99 /** project property file */ 100 public final static String FN_PROJECT_PROPERTIES = "project.properties"; //$NON-NLS-1$ 101 102 /** project local property file */ 103 public final static String FN_LOCAL_PROPERTIES = "local.properties"; //$NON-NLS-1$ 104 105 /** project ant property file */ 106 public final static String FN_ANT_PROPERTIES = "ant.properties"; //$NON-NLS-1$ 107 108 /** Skin layout file */ 109 public final static String FN_SKIN_LAYOUT = "layout"; //$NON-NLS-1$ 110 111 /** dx.jar file */ 112 public static final String FN_DX_JAR = "dx.jar"; //$NON-NLS-1$ 113 114 /** dx executable (with extension for the current OS) */ 115 public final static String FN_DX = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 116 "dx.bat" : "dx"; //$NON-NLS-1$ //$NON-NLS-2$ 117 118 /** aapt executable (with extension for the current OS) */ 119 public final static String FN_AAPT = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 120 "aapt.exe" : "aapt"; //$NON-NLS-1$ //$NON-NLS-2$ 121 122 /** aidl executable (with extension for the current OS) */ 123 public final static String FN_AIDL = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 124 "aidl.exe" : "aidl"; //$NON-NLS-1$ //$NON-NLS-2$ 125 126 /** renderscript executable (with extension for the current OS) */ 127 public final static String FN_RENDERSCRIPT = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 128 "llvm-rs-cc.exe" : "llvm-rs-cc"; //$NON-NLS-1$ //$NON-NLS-2$ 129 130 /** adb executable (with extension for the current OS) */ 131 public final static String FN_ADB = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 132 "adb.exe" : "adb"; //$NON-NLS-1$ //$NON-NLS-2$ 133 134 /** emulator executable for the current OS */ 135 public final static String FN_EMULATOR = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 136 "emulator.exe" : "emulator"; //$NON-NLS-1$ //$NON-NLS-2$ 137 138 /** zipalign executable (with extension for the current OS) */ 139 public final static String FN_ZIPALIGN = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 140 "zipalign.exe" : "zipalign"; //$NON-NLS-1$ //$NON-NLS-2$ 141 142 /** dexdump executable (with extension for the current OS) */ 143 public final static String FN_DEXDUMP = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 144 "dexdump.exe" : "dexdump"; //$NON-NLS-1$ //$NON-NLS-2$ 145 146 /** zipalign executable (with extension for the current OS) */ 147 public final static String FN_PROGUARD = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ? 148 "proguard.bat" : "proguard.sh"; //$NON-NLS-1$ //$NON-NLS-2$ 149 150 /** properties file for SDK Updater packages */ 151 public final static String FN_SOURCE_PROP = "source.properties"; //$NON-NLS-1$ 152 /** properties file for content hash of installed packages */ 153 public final static String FN_CONTENT_HASH_PROP = "content_hash.properties"; //$NON-NLS-1$ 154 /** properties file for the SDK */ 155 public final static String FN_SDK_PROP = "sdk.properties"; //$NON-NLS-1$ 156 157 /** 158 * filename for gdbserver. 159 */ 160 public final static String FN_GDBSERVER = "gdbserver"; //$NON-NLS-1$ 161 162 /** default proguard config file */ 163 public final static String FN_PROGUARD_CFG = "proguard.cfg"; //$NON-NLS-1$ 164 165 /* Folder Names for Android Projects . */ 166 167 /** Resources folder name, i.e. "res". */ 168 public final static String FD_RESOURCES = "res"; //$NON-NLS-1$ 169 /** Assets folder name, i.e. "assets" */ 170 public final static String FD_ASSETS = "assets"; //$NON-NLS-1$ 171 /** Default source folder name in an SDK project, i.e. "src". 172 * <p/> 173 * Note: this is not the same as {@link #FD_PKG_SOURCES} 174 * which is an SDK sources folder for packages. */ 175 public final static String FD_SOURCES = "src"; //$NON-NLS-1$ 176 /** Default generated source folder name, i.e. "gen" */ 177 public final static String FD_GEN_SOURCES = "gen"; //$NON-NLS-1$ 178 /** Default native library folder name inside the project, i.e. "libs" 179 * While the folder inside the .apk is "lib", we call that one libs because 180 * that's what we use in ant for both .jar and .so and we need to make the 2 development ways 181 * compatible. */ 182 public final static String FD_NATIVE_LIBS = "libs"; //$NON-NLS-1$ 183 /** Native lib folder inside the APK: "lib" */ 184 public final static String FD_APK_NATIVE_LIBS = "lib"; //$NON-NLS-1$ 185 /** Default output folder name, i.e. "bin" */ 186 public final static String FD_OUTPUT = "bin"; //$NON-NLS-1$ 187 /** Classes output folder name, i.e. "classes" */ 188 public final static String FD_CLASSES_OUTPUT = "classes"; //$NON-NLS-1$ 189 /** proguard output folder for mapping, etc.. files */ 190 public final static String FD_PROGUARD = "proguard"; //$NON-NLS-1$ 191 192 /* Folder Names for the Android SDK */ 193 194 /** Name of the SDK platforms folder. */ 195 public final static String FD_PLATFORMS = "platforms"; //$NON-NLS-1$ 196 /** Name of the SDK addons folder. */ 197 public final static String FD_ADDONS = "add-ons"; //$NON-NLS-1$ 198 /** Name of the SDK system-images folder. */ 199 public final static String FD_SYSTEM_IMAGES = "system-images"; //$NON-NLS-1$ 200 /** Name of the SDK sources folder where source packages are installed. 201 * <p/> 202 * Note this is not the same as {@link #FD_SOURCES} which is the folder name where sources 203 * are installed inside a project. */ 204 public final static String FD_PKG_SOURCES = "sources"; //$NON-NLS-1$ 205 /** Name of the SDK tools folder. */ 206 public final static String FD_TOOLS = "tools"; //$NON-NLS-1$ 207 /** Name of the SDK platform tools folder. */ 208 public final static String FD_PLATFORM_TOOLS = "platform-tools"; //$NON-NLS-1$ 209 /** Name of the SDK tools/lib folder. */ 210 public final static String FD_LIB = "lib"; //$NON-NLS-1$ 211 /** Name of the SDK docs folder. */ 212 public final static String FD_DOCS = "docs"; //$NON-NLS-1$ 213 /** Name of the doc folder containing API reference doc (javadoc) */ 214 public static final String FD_DOCS_REFERENCE = "reference"; //$NON-NLS-1$ 215 /** Name of the SDK images folder. */ 216 public final static String FD_IMAGES = "images"; //$NON-NLS-1$ 217 /** Name of the ABI to support. */ 218 public final static String ABI_ARMEABI = "armeabi"; //$NON-NLS-1$ 219 public final static String ABI_ARMEABI_V7A = "armeabi-v7a"; //$NON-NLS-1$ 220 public final static String ABI_INTEL_ATOM = "x86"; //$NON-NLS-1$ 221 /** Name of the CPU arch to support. */ 222 public final static String CPU_ARCH_ARM = "arm"; //$NON-NLS-1$ 223 public final static String CPU_ARCH_INTEL_ATOM = "x86"; //$NON-NLS-1$ 224 /** Name of the CPU model to support. */ 225 public final static String CPU_MODEL_CORTEX_A8 = "cortex-a8"; //$NON-NLS-1$ 226 227 /** Name of the SDK skins folder. */ 228 public final static String FD_SKINS = "skins"; //$NON-NLS-1$ 229 /** Name of the SDK samples folder. */ 230 public final static String FD_SAMPLES = "samples"; //$NON-NLS-1$ 231 /** Name of the SDK extras folder. */ 232 public final static String FD_EXTRAS = "extras"; //$NON-NLS-1$ 233 /** Name of the SDK templates folder, i.e. "templates" */ 234 public final static String FD_TEMPLATES = "templates"; //$NON-NLS-1$ 235 /** Name of the SDK Ant folder, i.e. "ant" */ 236 public final static String FD_ANT = "ant"; //$NON-NLS-1$ 237 /** Name of the SDK data folder, i.e. "data" */ 238 public final static String FD_DATA = "data"; //$NON-NLS-1$ 239 /** Name of the SDK renderscript folder, i.e. "rs" */ 240 public final static String FD_RENDERSCRIPT = "rs"; //$NON-NLS-1$ 241 /** Name of the SDK resources folder, i.e. "res" */ 242 public final static String FD_RES = "res"; //$NON-NLS-1$ 243 /** Name of the SDK font folder, i.e. "fonts" */ 244 public final static String FD_FONTS = "fonts"; //$NON-NLS-1$ 245 /** Name of the android sources directory */ 246 public static final String FD_ANDROID_SOURCES = "sources"; //$NON-NLS-1$ 247 /** Name of the addon libs folder. */ 248 public final static String FD_ADDON_LIBS = "libs"; //$NON-NLS-1$ 249 250 /** Namespace for the resource XML, i.e. "http://schemas.android.com/apk/res/android" */ 251 public final static String NS_RESOURCES = 252 "http://schemas.android.com/apk/res/android"; //$NON-NLS-1$ 253 254 /** The name of the uses-library that provides "android.test.runner" */ 255 public final static String ANDROID_TEST_RUNNER_LIB = 256 "android.test.runner"; //$NON-NLS-1$ 257 258 /* Folder path relative to the SDK root */ 259 /** Path of the documentation directory relative to the sdk folder. 260 * This is an OS path, ending with a separator. */ 261 public final static String OS_SDK_DOCS_FOLDER = FD_DOCS + File.separator; 262 263 /** Path of the tools directory relative to the sdk folder, or to a platform folder. 264 * This is an OS path, ending with a separator. */ 265 public final static String OS_SDK_TOOLS_FOLDER = FD_TOOLS + File.separator; 266 267 /** Path of the lib directory relative to the sdk folder, or to a platform folder. 268 * This is an OS path, ending with a separator. */ 269 public final static String OS_SDK_TOOLS_LIB_FOLDER = 270 OS_SDK_TOOLS_FOLDER + FD_LIB + File.separator; 271 272 /** 273 * Path of the lib directory relative to the sdk folder, or to a platform 274 * folder. This is an OS path, ending with a separator. 275 */ 276 public final static String OS_SDK_TOOLS_LIB_EMULATOR_FOLDER = OS_SDK_TOOLS_LIB_FOLDER 277 + "emulator" + File.separator; //$NON-NLS-1$ 278 279 /** Path of the platform tools directory relative to the sdk folder. 280 * This is an OS path, ending with a separator. */ 281 public final static String OS_SDK_PLATFORM_TOOLS_FOLDER = FD_PLATFORM_TOOLS + File.separator; 282 283 /** Path of the Platform tools Lib directory relative to the sdk folder. 284 * This is an OS path, ending with a separator. */ 285 public final static String OS_SDK_PLATFORM_TOOLS_LIB_FOLDER = 286 OS_SDK_PLATFORM_TOOLS_FOLDER + FD_LIB + File.separator; 287 288 /** Path of the bin folder of proguard folder relative to the sdk folder. 289 * This is an OS path, ending with a separator. */ 290 public final static String OS_SDK_TOOLS_PROGUARD_BIN_FOLDER = 291 SdkConstants.OS_SDK_TOOLS_FOLDER + 292 "proguard" + File.separator + //$NON-NLS-1$ 293 "bin" + File.separator; //$NON-NLS-1$ 294 295 /* Folder paths relative to a platform or add-on folder */ 296 297 /** Path of the images directory relative to a platform or addon folder. 298 * This is an OS path, ending with a separator. */ 299 public final static String OS_IMAGES_FOLDER = FD_IMAGES + File.separator; 300 301 /** Path of the skin directory relative to a platform or addon folder. 302 * This is an OS path, ending with a separator. */ 303 public final static String OS_SKINS_FOLDER = FD_SKINS + File.separator; 304 305 /* Folder paths relative to a Platform folder */ 306 307 /** Path of the data directory relative to a platform folder. 308 * This is an OS path, ending with a separator. */ 309 public final static String OS_PLATFORM_DATA_FOLDER = FD_DATA + File.separator; 310 311 /** Path of the renderscript directory relative to a platform folder. 312 * This is an OS path, ending with a separator. */ 313 public final static String OS_PLATFORM_RENDERSCRIPT_FOLDER = FD_RENDERSCRIPT + File.separator; 314 315 316 /** Path of the samples directory relative to a platform folder. 317 * This is an OS path, ending with a separator. */ 318 public final static String OS_PLATFORM_SAMPLES_FOLDER = FD_SAMPLES + File.separator; 319 320 /** Path of the resources directory relative to a platform folder. 321 * This is an OS path, ending with a separator. */ 322 public final static String OS_PLATFORM_RESOURCES_FOLDER = 323 OS_PLATFORM_DATA_FOLDER + FD_RES + File.separator; 324 325 /** Path of the fonts directory relative to a platform folder. 326 * This is an OS path, ending with a separator. */ 327 public final static String OS_PLATFORM_FONTS_FOLDER = 328 OS_PLATFORM_DATA_FOLDER + FD_FONTS + File.separator; 329 330 /** Path of the android source directory relative to a platform folder. 331 * This is an OS path, ending with a separator. */ 332 public final static String OS_PLATFORM_SOURCES_FOLDER = FD_ANDROID_SOURCES + File.separator; 333 334 /** Path of the android templates directory relative to a platform folder. 335 * This is an OS path, ending with a separator. */ 336 public final static String OS_PLATFORM_TEMPLATES_FOLDER = FD_TEMPLATES + File.separator; 337 338 /** Path of the Ant build rules directory relative to a platform folder. 339 * This is an OS path, ending with a separator. */ 340 public final static String OS_PLATFORM_ANT_FOLDER = FD_ANT + File.separator; 341 342 /** Path of the attrs.xml file relative to a platform folder. */ 343 public final static String OS_PLATFORM_ATTRS_XML = 344 OS_PLATFORM_RESOURCES_FOLDER + AndroidConstants.FD_RES_VALUES + File.separator + 345 FN_ATTRS_XML; 346 347 /** Path of the attrs_manifest.xml file relative to a platform folder. */ 348 public final static String OS_PLATFORM_ATTRS_MANIFEST_XML = 349 OS_PLATFORM_RESOURCES_FOLDER + AndroidConstants.FD_RES_VALUES + File.separator + 350 FN_ATTRS_MANIFEST_XML; 351 352 /** Path of the layoutlib.jar file relative to a platform folder. */ 353 public final static String OS_PLATFORM_LAYOUTLIB_JAR = 354 OS_PLATFORM_DATA_FOLDER + FN_LAYOUTLIB_JAR; 355 356 /** Path of the renderscript include folder relative to a platform folder. */ 357 public final static String OS_FRAMEWORK_RS = 358 FN_FRAMEWORK_RENDERSCRIPT + File.separator + FN_FRAMEWORK_INCLUDE; 359 /** Path of the renderscript (clang) include folder relative to a platform folder. */ 360 public final static String OS_FRAMEWORK_RS_CLANG = 361 FN_FRAMEWORK_RENDERSCRIPT + File.separator + FN_FRAMEWORK_INCLUDE_CLANG; 362 363 /* Folder paths relative to a addon folder */ 364 365 /** Path of the images directory relative to a folder folder. 366 * This is an OS path, ending with a separator. */ 367 public final static String OS_ADDON_LIBS_FOLDER = FD_ADDON_LIBS + File.separator; 368 369 /** Skin default **/ 370 public final static String SKIN_DEFAULT = "default"; //$NON-NLS-1$ 371 372 /** SDK property: ant templates revision */ 373 public final static String PROP_SDK_ANT_TEMPLATES_REVISION = 374 "sdk.ant.templates.revision"; //$NON-NLS-1$ 375 376 /** SDK property: default skin */ 377 public final static String PROP_SDK_DEFAULT_SKIN = "sdk.skin.default"; //$NON-NLS-1$ 378 379 380 /* Android Class Constants */ 381 public final static String CLASS_ACTIVITY = "android.app.Activity"; //$NON-NLS-1$ 382 public final static String CLASS_APPLICATION = "android.app.Application"; //$NON-NLS-1$ 383 public final static String CLASS_SERVICE = "android.app.Service"; //$NON-NLS-1$ 384 public final static String CLASS_BROADCASTRECEIVER = "android.content.BroadcastReceiver"; //$NON-NLS-1$ 385 public final static String CLASS_CONTENTPROVIDER = "android.content.ContentProvider"; //$NON-NLS-1$ 386 public final static String CLASS_INSTRUMENTATION = "android.app.Instrumentation"; //$NON-NLS-1$ 387 public final static String CLASS_INSTRUMENTATION_RUNNER = 388 "android.test.InstrumentationTestRunner"; //$NON-NLS-1$ 389 public final static String CLASS_BUNDLE = "android.os.Bundle"; //$NON-NLS-1$ 390 public final static String CLASS_R = "android.R"; //$NON-NLS-1$ 391 public final static String CLASS_MANIFEST_PERMISSION = "android.Manifest$permission"; //$NON-NLS-1$ 392 public final static String CLASS_INTENT = "android.content.Intent"; //$NON-NLS-1$ 393 public final static String CLASS_CONTEXT = "android.content.Context"; //$NON-NLS-1$ 394 public final static String CLASS_VIEW = "android.view.View"; //$NON-NLS-1$ 395 public final static String CLASS_VIEWGROUP = "android.view.ViewGroup"; //$NON-NLS-1$ 396 public final static String CLASS_NAME_LAYOUTPARAMS = "LayoutParams"; //$NON-NLS-1$ 397 public final static String CLASS_VIEWGROUP_LAYOUTPARAMS = 398 CLASS_VIEWGROUP + "$" + CLASS_NAME_LAYOUTPARAMS; //$NON-NLS-1$ 399 public final static String CLASS_NAME_FRAMELAYOUT = "FrameLayout"; //$NON-NLS-1$ 400 public final static String CLASS_FRAMELAYOUT = 401 "android.widget." + CLASS_NAME_FRAMELAYOUT; //$NON-NLS-1$ 402 public final static String CLASS_PREFERENCE = "android.preference.Preference"; //$NON-NLS-1$ 403 public final static String CLASS_NAME_PREFERENCE_SCREEN = "PreferenceScreen"; //$NON-NLS-1$ 404 public final static String CLASS_PREFERENCES = 405 "android.preference." + CLASS_NAME_PREFERENCE_SCREEN; //$NON-NLS-1$ 406 public final static String CLASS_PREFERENCEGROUP = "android.preference.PreferenceGroup"; //$NON-NLS-1$ 407 public final static String CLASS_PARCELABLE = "android.os.Parcelable"; //$NON-NLS-1$ 408 public static final String CLASS_FRAGMENT = "android.app.Fragment"; //$NON-NLS-1$ 409 public static final String CLASS_V4_FRAGMENT = "android.support.v4.app.Fragment"; //$NON-NLS-1$ 410 /** MockView is part of the layoutlib bridge and used to display classes that have 411 * no rendering in the graphical layout editor. */ 412 public final static String CLASS_MOCK_VIEW = "com.android.layoutlib.bridge.MockView"; //$NON-NLS-1$ 413 414 415 416 /** Returns the appropriate name for the 'android' command, which is 'android.bat' for 417 * Windows and 'android' for all other platforms. */ 418 public static String androidCmdName() { 419 String os = System.getProperty("os.name"); //$NON-NLS-1$ 420 String cmd = "android"; //$NON-NLS-1$ 421 if (os.startsWith("Windows")) { //$NON-NLS-1$ 422 cmd += ".bat"; //$NON-NLS-1$ 423 } 424 return cmd; 425 } 426 427 /** Returns the appropriate name for the 'mksdcard' command, which is 'mksdcard.exe' for 428 * Windows and 'mkdsdcard' for all other platforms. */ 429 public static String mkSdCardCmdName() { 430 String os = System.getProperty("os.name"); //$NON-NLS-1$ 431 String cmd = "mksdcard"; //$NON-NLS-1$ 432 if (os.startsWith("Windows")) { //$NON-NLS-1$ 433 cmd += ".exe"; //$NON-NLS-1$ 434 } 435 return cmd; 436 } 437 438 /** 439 * Returns current platform 440 * 441 * @return one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN}, 442 * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}. 443 */ 444 public static int currentPlatform() { 445 String os = System.getProperty("os.name"); //$NON-NLS-1$ 446 if (os.startsWith("Mac OS")) { //$NON-NLS-1$ 447 return PLATFORM_DARWIN; 448 } else if (os.startsWith("Windows")) { //$NON-NLS-1$ 449 return PLATFORM_WINDOWS; 450 } else if (os.startsWith("Linux")) { //$NON-NLS-1$ 451 return PLATFORM_LINUX; 452 } 453 454 return PLATFORM_UNKNOWN; 455 } 456 457 /** 458 * Returns current platform's UI name 459 * 460 * @return one of "Windows", "Mac OS X", "Linux" or "other". 461 */ 462 public static String currentPlatformName() { 463 String os = System.getProperty("os.name"); //$NON-NLS-1$ 464 if (os.startsWith("Mac OS")) { //$NON-NLS-1$ 465 return "Mac OS X"; //$NON-NLS-1$ 466 } else if (os.startsWith("Windows")) { //$NON-NLS-1$ 467 return "Windows"; //$NON-NLS-1$ 468 } else if (os.startsWith("Linux")) { //$NON-NLS-1$ 469 return "Linux"; //$NON-NLS-1$ 470 } 471 472 return "Other"; 473 } 474 } 475