fix(backlight): Check file existance

This commit is contained in:
Michael Carlberg 2016-06-01 16:06:24 +02:00
parent 4cbd53810b
commit 9321fb0db9
1 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,12 @@ BacklightModule::BacklightModule(const std::string& name_) : InotifyModule(name_
this->path_val = string::replace(PATH_BACKLIGHT_VAL, "%card%", card);
this->path_max = string::replace(PATH_BACKLIGHT_MAX, "%card%", card);
this->watch(string::replace(PATH_BACKLIGHT_VAL, "%card%", card));
if (!io::file::exists(this->path_val))
throw ModuleError("[BacklightModule] The file \""+ this->path_val +"\" does not exist");
if (!io::file::exists(this->path_max))
throw ModuleError("[BacklightModule] The file \""+ this->path_max +"\" does not exist");
this->watch(this->path_val);
}
bool BacklightModule::on_event(InotifyEvent *event)