branch: elpa/projectile
commit 74165f722d2e07f3c78a6a9a8173a1336766f153
Author: Bozhidar Batsov <bozhi...@batsov.dev>
Commit: Bozhidar Batsov <bozhi...@batsov.dev>

    [Fix #1850] Ensure the presence of a project in projectile-compilation-dir
---
 CHANGELOG.md  |  1 +
 projectile.el | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d901d2bd5..2b0478a88c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@
 * [#1881](https://github.com/bbatsov/projectile/issues/1881): Fix 
`projectile-recentf` when called outside any project.
 * [#1910](https://github.com/bbatsov/projectile/pull/1910): Reverts 
[#1895](https://github.com/bbatsov/projectile/pull/1895) as those changes 
appear to cause a significant performance regression across a number of 
use-cases.
 * [#1915](https://github.com/bbatsov/projectile/pull/1915): Fix dotnet-sln 
project-type recognition. (check `*.sln` files instead of `src/`)
+* [#1850](https://github.com/bbatsov/projectile/issues/1850): Ensure the 
presence of a project in `projectile-compilation-dir`.
 
 ## 2.8.0 (2023-10-13)
 
diff --git a/projectile.el b/projectile.el
index b5e674773f..034c0a699c 100644
--- a/projectile.el
+++ b/projectile.el
@@ -5214,14 +5214,15 @@ project of that type"
 
 (defun projectile-compilation-dir ()
   "Retrieve the compilation directory for this project."
-  (let* ((type (projectile-project-type))
-         (directory (or projectile-project-compilation-dir
+  (let* ((project-root (projectile-acquire-root))
+         (type (projectile-project-type project-root))
+         (comp-dir (or projectile-project-compilation-dir
                         (projectile-default-compilation-dir type))))
-    (if directory
+    (if comp-dir
         (file-truename
-         (concat (file-name-as-directory (projectile-project-root))
-                 (file-name-as-directory directory)))
-      (projectile-project-root))))
+         (concat (file-name-as-directory project-root)
+                 (file-name-as-directory comp-dir)))
+      project-root)))
 
 (defun projectile-maybe-read-command (arg default-cmd prompt)
   "Prompt user for command unless DEFAULT-CMD is an Elisp function."

Reply via email to