001 /* 002 * Copyright 2010-2015 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.kotlin.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 @NotNull 050 @Override 051 public File getReflectPath() { 052 return getLibraryFile(PathUtil.KOTLIN_JAVA_REFLECT_JAR); 053 } 054 055 @NotNull 056 @Override 057 public File getKotlinTestPath() { 058 return getLibraryFile(PathUtil.KOTLIN_TEST_JAR); 059 } 060 061 @NotNull 062 @Override 063 public File getRuntimeSourcesPath() { 064 return getLibraryFile(PathUtil.KOTLIN_JAVA_RUNTIME_SRC_JAR); 065 } 066 067 @Override 068 @NotNull 069 public File getJsStdLibJarPath() { 070 return getLibraryFile(PathUtil.JS_LIB_JAR_NAME); 071 } 072 073 @Override 074 @NotNull 075 public File getJsStdLibSrcJarPath() { 076 return getLibraryFile(PathUtil.JS_LIB_SRC_JAR_NAME); 077 } 078 079 @NotNull 080 @Override 081 public File getCompilerPath() { 082 return getLibraryFile(PathUtil.KOTLIN_COMPILER_JAR); 083 } 084 085 @NotNull 086 private File getLibraryFile(@NotNull String fileName) { 087 return new File(getLibPath(), fileName); 088 } 089 }