本文整理汇总了Java中com.android.SdkConstants.CURRENT_PLATFORM属性的典型用法代码示例。如果您正苦于以下问题:Java SdkConstants.CURRENT_PLATFORM属性的具体用法?Java SdkConstants.CURRENT_PLATFORM怎么用?Java SdkConstants.CURRENT_PLATFORM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.android.SdkConstants
的用法示例。
在下文中一共展示了SdkConstants.CURRENT_PLATFORM属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
public void build(@NonNull CommandLineLauncher launcher)
throws IOException, InterruptedException {
// get the env var
Map<String, String> env = Maps.newHashMap();
if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
env.put("DYLD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
} else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
env.put("LD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
}
doMainCompilation(launcher, env);
if (mSupportMode) {
createSupportFiles(launcher, env);
}
}
示例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();
}
}
示例3: 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();
}
}
}
}