aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-03-29 15:00:07 -0500
committerJoel Martin <github@martintribe.org>2014-03-29 15:00:07 -0500
commitdc7938d8e69982b2574a8e2e9fd1ca97b33f6e28 (patch)
tree4d158f596511fa5d5f9fd2272c738724ed0fd63a
parent285b5ba7934222316872f189f886d1b9cec90793 (diff)
downloadmal-dc7938d8e69982b2574a8e2e9fd1ca97b33f6e28.tar.gz
mal-dc7938d8e69982b2574a8e2e9fd1ca97b33f6e28.zip
Clojure, Java, PHP: remove hardcoded readline history path.
-rw-r--r--clojure/src/readline.clj2
-rw-r--r--java/src/main/java/mal/readline.java6
-rw-r--r--php/readline.php2
3 files changed, 7 insertions, 3 deletions
diff --git a/clojure/src/readline.clj b/clojure/src/readline.clj
index dbd4872..0fc449a 100644
--- a/clojure/src/readline.clj
+++ b/clojure/src/readline.clj
@@ -3,7 +3,7 @@
[net.n01se.clojure-jna :as jna]))
(defonce history-loaded (atom nil))
-(def HISTORY-FILE "/home/joelm/.mal-history")
+(def HISTORY-FILE (str (System/getProperty "user.home") "/.mal-history"))
;;
;; Uncomment one of the following readline libraries
diff --git a/java/src/main/java/mal/readline.java b/java/src/main/java/mal/readline.java
index 1705f39..9220267 100644
--- a/java/src/main/java/mal/readline.java
+++ b/java/src/main/java/mal/readline.java
@@ -19,9 +19,13 @@ class readline {
public enum Mode { JNA, JAVA }
static Mode mode = Mode.JNA;
- static String HISTORY_FILE = "/home/joelm/.mal-history";
+ static String HISTORY_FILE = null;
static Boolean historyLoaded = false;
+ static {
+ HISTORY_FILE = System.getProperty("user.home") + "/.mal-history";
+ }
+
public static class EOFException extends Exception {
}
diff --git a/php/readline.php b/php/readline.php
index 28d720d..d4b3ad7 100644
--- a/php/readline.php
+++ b/php/readline.php
@@ -1,6 +1,6 @@
<?php
-$HISTORY_FILE = "/home/joelm/.mal-history";
+$HISTORY_FILE = $_SERVER['HOME'] . "/.mal-history";
function mal_readline($prompt) {
global $HISTORY_FILE;