feat(application): add normalizeWatchPaths method to improve watch path handling
This commit is contained in:
parent
54f6813f29
commit
a1f865c1fd
1 changed files with 16 additions and 3 deletions
|
|
@ -1728,16 +1728,29 @@ public static function globToRegex(string $pattern): string
|
|||
return '#^'.$regex.'$#';
|
||||
}
|
||||
|
||||
public function normalizeWatchPaths(): void
|
||||
{
|
||||
if (is_null($this->watch_paths)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$normalized = $this->parseWatchPaths($this->watch_paths);
|
||||
if ($normalized !== $this->watch_paths) {
|
||||
$this->watch_paths = $normalized;
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function isWatchPathsTriggered(Collection $modified_files): bool
|
||||
{
|
||||
if (is_null($this->watch_paths)) {
|
||||
return false;
|
||||
}
|
||||
$this->watch_paths = $this->parseWatchPaths($this->watch_paths);
|
||||
$this->save();
|
||||
|
||||
$this->normalizeWatchPaths();
|
||||
|
||||
$watch_paths = collect(explode("\n", $this->watch_paths));
|
||||
|
||||
// If no valid patterns after filtering, don't trigger
|
||||
if ($watch_paths->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue