<commit_before>package com.beust.kobalt.internal.build

import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.log
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.attribute.BasicFileAttributes
/**
 * Sometimes, build files are moved to temporary files, so we give them a specific name for clarity.
 * @param path is the path where that file was moved, @param realPath is where the actual file is.
 */
class BuildFile(val path: Path, val name: String, val realPath: Path = path) {
    fun exists() : Boolean = Files.exists(path)

    val lastModified : Long
        get() = Files.readAttributes(realPath, BasicFileAttributes::class.java).lastModifiedTime().toMillis()

    val directory : File get() = path.toFile().parentFile

    /**
     * @return the .kobalt directory where this build file will be compiled.
     */
    val dotKobaltDir: File get() = File(directory.parentFile.parentFile, KFiles.KOBALT_DOT_DIR).apply {
        mkdirs()
    }

    /**
     * @return the absolute directory of this projects' location, assuming the build file is in
     * $project/kobalt/src/Build.kt.
     */
    val absoluteDir : File get() {
        log(1, "Current path: $path")
        return path.parent.parent.parent.toFile()
    }
}<commit_msg>NPE work.<commit_after>package com.beust.kobalt.internal.build

import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.log
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.attribute.BasicFileAttributes
/**
 * Sometimes, build files are moved to temporary files, so we give them a specific name for clarity.
 * @param path is the path where that file was moved, @param realPath is where the actual file is.
 */
class BuildFile(val path: Path, val name: String, val realPath: Path = path) {
    fun exists() : Boolean = Files.exists(path)

    val lastModified : Long
        get() = Files.readAttributes(realPath, BasicFileAttributes::class.java).lastModifiedTime().toMillis()

    val directory : File get() = path.toFile().parentFile

    /**
     * @return the .kobalt directory where this build file will be compiled.
     */
    val dotKobaltDir: File get() = File(directory.parentFile.parentFile, KFiles.KOBALT_DOT_DIR).apply {
        mkdirs()
    }

    /**
     * @return the absolute directory of this projects' location, assuming the build file is in
     * $project/kobalt/src/Build.kt.
     */
    val absoluteDir : File? get() {
        log(1, "Current path: $path")
        return path.parent?.parent?.parent?.toFile()
    }
}
{'fraction_non_alphanumeric': 0.11081081081081082, 'fraction_numerical': 0.0007722007722007722, 'mean_word_length': 3.325542570951586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '986942', 'n_tokens_mistral': 784, 'n_tokens_neox': 770, 'n_words': 237}