lib/cpee/implementation.rb in cpee-1.3.215 vs lib/cpee/implementation.rb in cpee-1.3.216
- old
+ new
@@ -64,11 +64,11 @@
end unless opts[:handlerwrappers].strip == ''
controller = {}
Dir[opts[:instances] + '/*/properties.xml'].each do |e|
id = ::File::basename(::File::dirname(e))
- (controller[id.to_i] = Controller.new(id,opts)) rescue nil
+ (controller[id.to_i] = (Controller.new(id,opts)) rescue nil)
end
interface 'properties' do |r|
id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i
use Riddl::Utils::Properties::implementation(controller[id].properties, PropertiesHandler.new(controller[id]), opts[:mode]) if controller[id]
@@ -155,12 +155,15 @@
name = @p[0].value
id = controller.keys.sort.last.to_i
while true
id += 1
- Dir.mkdir(opts[:instances] + "/#{id}") rescue nil
- break
+ unless Dir.exists? opts[:instances] + "/#{id}"
+ Dir.mkdir(opts[:instances] + "/#{id}") rescue nil
+ break
+ end
end
+
controller[id] = Controller.new(id,opts)
info = controller[id].properties.data.find("/p:properties/p:attributes/p:info")
info.first.text = name if info.length == 1
Riddl::Parameter::Simple.new("id", id)