<commit_before>(ns nightmod.utils
  (:require [clojure.java.io :as io])
  (:import [java.text SimpleDateFormat]))

(def ^:const properties-file ".properties")

(def main-dir (atom nil))
(def project-dir (atom nil))
(def error (atom nil))

(defn get-data-dir
  []
  (let [home-dir (System/getProperty "user.home")
        app-name "Nightmod"
        app-name-lower (clojure.string/lower-case app-name)
        osx-dir (io/file home-dir "Library" "Application Support" app-name)
        win-dir (io/file home-dir "AppData" "Roaming" app-name)]
    (.getCanonicalPath
      (cond
        (.exists (.getParentFile osx-dir)) osx-dir
        (.exists (.getParentFile win-dir)) win-dir
        :else (if-let [config-dir (System/getenv "XDG_CONFIG_HOME")]
                (io/file config-dir app-name-lower)
                (io/file home-dir ".config" app-name-lower))))))

(defn format-date
  [unix-time]
  (.format (SimpleDateFormat. "yyyy.MM.dd HH:mm:ss") unix-time))

(defn new-project!
  [template]
  (let [project-name (str (System/currentTimeMillis))
        project-file (io/file @main-dir project-name)]
    (.mkdirs project-file)
    (doseq [f (-> (io/resource template) io/file .listFiles)]
      (io/copy f (io/file project-file (.getName f))))
    (.getCanonicalPath project-file)))<commit_msg>Simplify location of data dir<commit_after>(ns nightmod.utils
  (:require [clojure.java.io :as io])
  (:import [java.text SimpleDateFormat]))

(def ^:const properties-file ".properties")

(def main-dir (atom nil))
(def project-dir (atom nil))
(def error (atom nil))

(defn get-data-dir
  []
  (.getCanonicalPath (io/file (System/getProperty "user.home") "nightmod")))

(defn format-date
  [unix-time]
  (.format (SimpleDateFormat. "yyyy.MM.dd HH:mm:ss") unix-time))

(defn new-project!
  [template]
  (let [project-name (str (System/currentTimeMillis))
        project-file (io/file @main-dir project-name)]
    (.mkdirs project-file)
    (doseq [f (-> (io/resource template) io/file .listFiles)]
      (io/copy f (io/file project-file (.getName f))))
    (.getCanonicalPath project-file)))
{'fraction_non_alphanumeric': 0.1656294877932025, 'fraction_numerical': 0.0, 'mean_word_length': 3.291581108829569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3477937', 'n_tokens_mistral': 751, 'n_tokens_neox': 722, 'n_words': 176}