From 8f019c56b03dea05849f61112393d8d25c30da6a Mon Sep 17 00:00:00 2001
From: Yanis HAMOUDI <yanis.hamoudi@etu.u-pec.fr>
Date: Sun, 16 Mar 2025 18:25:55 +0100
Subject: [PATCH] Correction bug

---
 src/fr/monlouyan/bakefile/Rule.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/fr/monlouyan/bakefile/Rule.java b/src/fr/monlouyan/bakefile/Rule.java
index 9a23cd1..cbf0689 100644
--- a/src/fr/monlouyan/bakefile/Rule.java
+++ b/src/fr/monlouyan/bakefile/Rule.java
@@ -99,6 +99,14 @@ public class Rule {
             File targetFile = new File(cleanFileName(name));
             System.out.println("Debug : Target file '" + name + "' exists: " + targetFile.exists());
         }
+
+		boolean isRequestedTarget = BakeCLI.getTargets().contains(name) || 
+                            (BakeCLI.getTargets().isEmpty() && name.equals(BakefileParser.getFirstTarget()));
+		
+		// Traiter les chemins commençant par ~ de manière spéciale
+		if (name.startsWith("~") && !isRequestedTarget) {
+			return false;  
+		}
     
         // Les règles phony sont toujours mises à jour
         if (isPhony) {