当前位置: 首页>>代码示例>>Java>>正文


Java SdkConstants.PLATFORM_WINDOWS属性代码示例

本文整理汇总了Java中com.android.SdkConstants.PLATFORM_WINDOWS属性的典型用法代码示例。如果您正苦于以下问题:Java SdkConstants.PLATFORM_WINDOWS属性的具体用法?Java SdkConstants.PLATFORM_WINDOWS怎么用?Java SdkConstants.PLATFORM_WINDOWS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.android.SdkConstants的用法示例。


在下文中一共展示了SdkConstants.PLATFORM_WINDOWS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkIfInitFailed

/**
 * Check if any error occurred during initialization.
 * If it did, display an error message.
 *
 * @return True if an error occurred, false if we should continue.
 */
public boolean checkIfInitFailed() {
    if (mAvdManagerInitError != null) {
        String example;
        if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS) {
            example = "%USERPROFILE%";     //$NON-NLS-1$
        } else {
            example = "~";                 //$NON-NLS-1$
        }

        String error = String.format(
            "The AVD manager normally uses the user's profile directory to store " +
            "AVD files. However it failed to find the default profile directory. " +
            "\n" +
            "To fix this, please set the environment variable ANDROID_SDK_HOME to " +
            "a valid path such as \"%s\".",
            example);

        displayInitError(error);

        return true;
    }
    return false;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:UpdaterData.java

示例2: printMessage

private void printMessage(String msg, PrintStream stream) {
    if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS &&
            !msg.endsWith("\r\n") &&
            msg.endsWith("\n")) {
        // remove last \n so that println can use \r\n as needed.
        msg = msg.substring(0, msg.length() - 1);
    }

    stream.print(msg);

    if (!msg.endsWith("\n")) {
        stream.println();
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:StdLogger.java

示例3: isAvdNameConflicting

/**
 * Returns whether this AVD name would generate a conflict.
 *
 * @param name the name of the AVD to return
 * @return A pair of {@link AvdConflict} and the path or AVD name that conflicts.
 */
@NonNull
public Pair<AvdConflict, String> isAvdNameConflicting(@Nullable String name) {

    boolean ignoreCase = SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS;

    // Check whether we have a conflict with an existing or invalid AVD
    // known to the manager.
    synchronized (mAllAvdList) {
        for (AvdInfo info : mAllAvdList) {
            String name2 = info.getName();
            if (name2.equals(name) || (ignoreCase && name2.equalsIgnoreCase(name))) {
                if (info.getStatus() == AvdStatus.OK) {
                    return Pair.of(AvdConflict.CONFLICT_EXISTING_AVD, name2);
                } else {
                    return Pair.of(AvdConflict.CONFLICT_INVALID_AVD, name2);
                }
            }
        }
    }

    // No conflict with known AVDs.
    // Are some existing files/folders in the way of creating this AVD?

    try {
        File file = AvdInfo.getDefaultIniFile(this, name);
        if (file.exists()) {
            return Pair.of(AvdConflict.CONFLICT_EXISTING_PATH, file.getPath());
        }

        file = AvdInfo.getDefaultAvdFolder(this, name);
        if (file.exists()) {
            return Pair.of(AvdConflict.CONFLICT_EXISTING_PATH, file.getPath());
        }

    } catch (AndroidLocationException e) {
        // ignore
    }


    return Pair.of(AvdConflict.NO_CONFLICT, null);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:47,代码来源:AvdManager.java

示例4: deleteFileOrFolder

/**
 * Helper to delete a file or a directory.
 * For a directory, recursively deletes all of its content.
 * Files that cannot be deleted right away are marked for deletion on exit.
 * It's ok for the file or folder to not exist at all.
 * The argument can be null.
 */
@Override
public void deleteFileOrFolder(@NonNull File fileOrFolder) {
    if (fileOrFolder != null) {
        if (isDirectory(fileOrFolder)) {
            // Must delete content recursively first
            File[] files = fileOrFolder.listFiles();
            if (files != null) {
                for (File item : files) {
                    deleteFileOrFolder(item);
                }
            }
        }

        // Don't try to delete it if it doesn't exist.
        if (!exists(fileOrFolder)) {
            return;
        }

        if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) {
            // Trying to delete a resource on windows might fail if there's a file
            // indexer locking the resource. Generally retrying will be enough to
            // make it work.
            //
            // Try for half a second before giving up.

            for (int i = 0; i < 5; i++) {
                if (fileOrFolder.delete()) {
                    return;
                }

                try {
                    Thread.sleep(100 /*ms*/);
                } catch (InterruptedException e) {
                    // Ignore.
                }
            }

            fileOrFolder.deleteOnExit();

        } else {
            // On Linux or Mac, just straight deleting it should just work.

            if (!fileOrFolder.delete()) {
                fileOrFolder.deleteOnExit();
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:55,代码来源:FileOp.java


注:本文中的com.android.SdkConstants.PLATFORM_WINDOWS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。