[eiffel-users] File vs. Directory

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[eiffel-users] File vs. Directory

Larry Rix
I have a routine that recursively scans down a directory tree looking for a file.

In Windows, {DIRECTORY}.entries that are actually files (i.e. not folders or directories) are ignored. However, in Linux, the code breaks on DIRECTORY.dir_open with an OS signal of "Not a directory").

The best I have been able to do so far is to detect 

if not (ic.item.is_current_symbol or ic.item.is_parent_symbol) and not attached ic.item.extension then

this fails

help? :)

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[eiffel-users] Re: File vs. Directory

Larry Rix
I have done more investigation to discover that the FILE class has an `exists' and `is_directory', but the features seem to be at odds with each other.

First--the PATH class, whose docx and comments seem to indicate it can represent both a file and a directory, but provides no facility to differentiate between the two.

Second--the FILE class has the `is_directory', but seems at odds against itself because of a require of `exists'. When stopped in the debugger, the `is_directory' for RAW_FILE will show True, but the `exists' will show False. This seems to not be the truth. The PATH references are taken from the DIRECTORY.entries, so they DO EXIST. There is no denying it, but the `exists' features says False. This then breaks the call to `is_directory' because it requires that `exists' = True. I am SO CONFUSED! :)

Moreover--the very nature of FILE says FILE and not DIRECTORY, so why does FILE have `is_directory'? Should not PATH have `is_directory' because a "PATH" (in the sense of the class) seems to say it can represent both FILE and DIRECTORY? Again--I am really confused.

In Windows this worked without issue (or at least issues were not detected or reported by the OS). Now, in Linux, it has become an issue.

Anyone have any guidance? :)

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[eiffel-users] Re: File vs. Directory

Larry Rix
In reply to this post by Larry Rix
It turns out that the solution was FILE_UTILITIES.ends_with as a replacement for my code. Moreover, the answer I was seeking is in this code. The l_dir.exists and l_dir.is_readable. Afterwards, making l_dir.open_read and then reading entry by entry instead of using the entries array.

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Loading...