001 /* 002 * Copyright 2010-2013 JetBrains s.r.o. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.jetbrains.jet.utils; 018 019 import org.jetbrains.annotations.NotNull; 020 021 import java.io.File; 022 023 public class KotlinPathsFromHomeDir implements KotlinPaths { 024 // kotlinc directory 025 private final File homePath; 026 027 public KotlinPathsFromHomeDir(@NotNull File homePath) { 028 this.homePath = homePath; 029 } 030 031 @Override 032 @NotNull 033 public File getHomePath() { 034 return homePath; 035 } 036 037 @Override 038 @NotNull 039 public File getLibPath() { 040 return new File(homePath, "lib"); 041 } 042 043 @Override 044 @NotNull 045 public File getRuntimePath() { 046 return getLibraryFile(PathUtil.KOTLIN_JAVA_RUNTIME_JAR); 047 } 048 049 @Override 050 @NotNull 051 public File getJdkAnnotationsPath() { 052 return getLibraryFile(PathUtil.JDK_ANNOTATIONS_JAR); 053 } 054 055 @NotNull 056 @Override 057 public File getAndroidSdkAnnotationsPath() { 058 return getLibraryFile(PathUtil.ANDROID_SDK_ANNOTATIONS_JAR); 059 } 060 061 @Override 062 @NotNull 063 public File getJsLibJsPath() { 064 return getLibraryFile(PathUtil.JS_LIB_JS_NAME); 065 } 066 067 @Override 068 @NotNull 069 public File getJsLibJarPath() { 070 return getLibraryFile(PathUtil.JS_LIB_JAR_NAME); 071 } 072 073 @NotNull 074 private File getLibraryFile(@NotNull String fileName) { 075 return new File(getLibPath(), fileName); 076 } 077 }