Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve FolderObserver #4444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ protected void addModelParser(ModelParser modelParser) {
logger.debug("Adding parser for '{}' extension", extension);
parsers.add(extension);

// check if the desired directory exists and create it if it's missing
try {
Path extensionPath = watchService.getWatchPath().resolve(extension);
Files.createDirectories(extensionPath);
} catch (IOException e) {
logger.error("Model path for extension '{}' is missing and creation failed: {}", extension, e.getMessage());
}
Comment on lines +100 to +105
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the suggestion is

Path extensionPath = watchService.getWatchPath().resolve(extension);
if (!Files.isDirectory(extensionPath)) {
  logger.error("Model path for extension '{}' is missing or not accessible. Please create it and restart openHAB.", extension);
}


if (activated) {
processIgnoredPaths(extension);
readyService.markReady(new ReadyMarker(READYMARKER_TYPE, extension));
Expand Down