emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql e7b932a5c9 378/427: Handle read-only emacsql insta


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql e7b932a5c9 378/427: Handle read-only emacsql install diretory
Date: Tue, 13 Dec 2022 03:00:13 -0500 (EST)

branch: elpa/emacsql
commit e7b932a5c9ce3406492121561fd4191e406e1a21
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>

    Handle read-only emacsql install diretory
    
    Some systems will have set installs to read-only. This means that we
    cannot comopile emacsql-sqlite directly in that directory. Luckily, it
    is very easy to make emacsql-sqlite compile to an arbitrary directory.
    This patch uses ~/.emacs.d/sqlite/emacsql-sqlite as a backup when the
    install directory is read only.
---
 emacsql-sqlite.el | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el
index c4703a29ae..9a614f0b60 100644
--- a/emacsql-sqlite.el
+++ b/emacsql-sqlite.el
@@ -27,11 +27,19 @@
   (file-name-directory (or load-file-name buffer-file-name))
   "Directory where EmacSQL is installed.")
 
+(defvar emacsql-sqlite-executable-path
+  (if (memq system-type '(windows-nt cygwin ms-dos))
+      "sqlite/emacsql-sqlite.exe"
+    "sqlite/emacsql-sqlite")
+  "Relative path to emacsql executable.")
+
 (defvar emacsql-sqlite-executable
-  (expand-file-name (if (memq system-type '(windows-nt cygwin ms-dos))
-                        "sqlite/emacsql-sqlite.exe"
-                      "sqlite/emacsql-sqlite")
-                    emacsql-sqlite-data-root)
+  (expand-file-name emacsql-sqlite-executable-path
+                    (if (or (file-writable-p emacsql-sqlite-data-root)
+                            (file-exists-p (expand-file-name
+                                            emacsql-sqlite-executable-path
+                                            emacsql-sqlite-data-root)))
+                        emacsql-sqlite-data-root user-emacs-directory))
   "Path to the EmacSQL backend (this is not the sqlite3 shell).")
 
 (defvar emacsql-sqlite-reserved
@@ -164,6 +172,7 @@ If called with non-nil ASYNC the return value is 
meaningless."
            (prog1 nil
              (message "Could not find C compiler, skipping SQLite build")))
           (t (message "Compiling EmacSQL SQLite binary ...")
+             (mkdir (file-name-directory emacsql-sqlite-executable) t)
              (let ((log (get-buffer-create byte-compile-log-buffer)))
                (with-current-buffer log
                  (let ((inhibit-read-only t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]