Closed erw7 closed 9 years ago
Thanks. I committed a slightly different version of this fix in 8f75d2e.
Thanks. but I think next code is better.
(set (make-local-variable 'sql-database) (or (cdr (assoc "database" database-alist))
(when (string-match "sqlite" adapter)
(concat "db/" environment ".sqlite3"))
(concat (file-name-nondirectory (rinari-root))
"_" environment)))
(when
(and
(string-match "sqlite" adapter)
(not (string-match "^"\\(^/\\|[[:alpha:]]:\\(/\\|\\\\\\)\\)"" sql-database)))
(setq sql-database (expand-file-name sql-database (rinari-root))))
I was going to send the other pull request for append rinari-root when adapter was sqlite.
And next change has been missing.
(concat (file-name-nondirectory (directory-file-name (rinari-root)))
"_" environment)
Done. The filename regexp isn't necessary, because expand-file-name
understands canonical paths:
(expand-file-name "/foo/bar" "/tmp")
gives
"/foo/bar"
Thanks for all your help with this!
Hmmm. Thanks for your quick work.
file-name-nondirectory return empty string if FILENAME is ending with a slash, So changed to delete the last slash before call file-name-nondirectory.
Changed to set an appropriate value when adapter was sqlite.