forked from quickshell/quickshell
core/reloader: watch new files detected in failed reloads
This commit is contained in:
parent
e931b85464
commit
4472b27039
3 changed files with 35 additions and 5 deletions
|
@ -162,6 +162,11 @@ void EngineGeneration::setWatchingFiles(bool watching) {
|
|||
this->watcher->addPath(QFileInfo(file).dir().absolutePath());
|
||||
}
|
||||
|
||||
for (auto& file: this->extraWatchedFiles) {
|
||||
this->watcher->addPath(file);
|
||||
this->watcher->addPath(QFileInfo(file).dir().absolutePath());
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
this->watcher,
|
||||
&QFileSystemWatcher::fileChanged,
|
||||
|
@ -184,6 +189,22 @@ void EngineGeneration::setWatchingFiles(bool watching) {
|
|||
}
|
||||
}
|
||||
|
||||
bool EngineGeneration::setExtraWatchedFiles(const QVector<QString>& files) {
|
||||
this->extraWatchedFiles.clear();
|
||||
for (const auto& file: files) {
|
||||
if (!this->scanner.scannedFiles.contains(file)) {
|
||||
this->extraWatchedFiles.append(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->watcher) {
|
||||
this->setWatchingFiles(false);
|
||||
this->setWatchingFiles(true);
|
||||
}
|
||||
|
||||
return !this->extraWatchedFiles.isEmpty();
|
||||
}
|
||||
|
||||
void EngineGeneration::onFileChanged(const QString& name) {
|
||||
if (!this->watcher->files().contains(name)) {
|
||||
this->deletedWatchedFiles.push_back(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue