eiffel

How to traverse a directory in eiffel?


Simple

How can I get a list of the files that are inside directory using eiffel?


Solution

  • with recent version of Eiffel, I would recommend to use DIRECTORY.entries

    local
        p: PATH 
    do
        across dir.entries as ic loop
            p := ic.item.path
                -- then use interface of PATH, such as PATH.name 
        end
    end
    

    note that the base_extension library also provides DIRECTORY_VISITOR , which is helpful to iterate recursively on directories