Skip to content

Commit

Permalink
add recursive to file interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmelt committed Dec 8, 2024
1 parent 83b3d21 commit 76dfce0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions openc3/lib/openc3/interfaces/file_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def initialize(
@label = "command"
@queue = Queue.new
@polling = false
@recursive = false
end

def connect
Expand Down Expand Up @@ -119,7 +120,7 @@ def read_interface

# Wait for a file to read
result = @queue.pop
break unless result
return nil, nil unless result
end
end

Expand Down Expand Up @@ -154,6 +155,8 @@ def set_option(option_name, option_values)
@extension = option_values[0]
when 'POLLING'
@polling = ConfigParser.handle_true_false(option_values[0])
when 'RECURSIVE'
@recursive = ConfigParser.handle_true_false(option_values[0])
end
end

Expand All @@ -171,7 +174,11 @@ def finish_file
end

def get_next_telemetry_file
Dir.glob("#{@telemetry_read_folder}/*").sort[0]
if @recursive
return Dir.glob("#{@telemetry_read_folder}/**/*").sort[0]
else
return Dir.glob("#{@telemetry_read_folder}/*").sort[0]
end
end

def create_unique_filename
Expand Down

0 comments on commit 76dfce0

Please sign in to comment.