Path separator

18 views
Skip to first unread message

Alexandr Naumchev

unread,
Apr 5, 2018, 6:57:14 AM4/5/18
to Eiffel Users
Is there an easy way to have the path separator for the current operating system?

Jocelyn Fiat

unread,
Apr 5, 2018, 7:00:57 AM4/5/18
to Eiffel Users
Check {OPERATING_ENVIRONMENT}.Directory_separator

I would also recommend to use the class PATH, for any path representation and manipulation.

Regards,
-- Jocelyn Fiat.

On Thu, Apr 5, 2018 at 12:57 PM, Alexandr Naumchev <anau...@gmail.com> wrote:
Is there an easy way to have the path separator for the current operating system?

--
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 eiffel-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.



--
Jocelyn
------------------------------------------------------------------------
Eiffel Software
https://www.eiffel.com
Customer support: https://support.eiffel.com
User group: https://groups.google.com/forum/#!forum/eiffel-users
------------------------------------------------------------------------

Alexandr Naumchev

unread,
Apr 5, 2018, 7:13:31 AM4/5/18
to Eiffel Users
Great, thanks!


On Thursday, April 5, 2018 at 2:00:57 PM UTC+3, Jocelyn Fiat wrote:
Check {OPERATING_ENVIRONMENT}.Directory_separator

I would also recommend to use the class PATH, for any path representation and manipulation.

Regards,
-- Jocelyn Fiat.
On Thu, Apr 5, 2018 at 12:57 PM, Alexandr Naumchev <anau...@gmail.com> wrote:
Is there an easy way to have the path separator for the current operating system?

--
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 eiffel-users...@googlegroups.com.

Finnian Reilly

unread,
Apr 6, 2018, 11:25:23 AM4/6/18
to Eiffel Users
PATH v EL_PATH



I would also recommend to use the class PATH, for any path representation and manipulation.

Personally I prefer to use the EL_PATH descendants found in Eiffel-Loop.

EL_PATH*
   EL_DIR_PATH
      EL_DIR_URI_PATH
   EL_FILE_PATH
      EL_FILE_URI_PATH
   EL_URI_PATH
*
      EL_FILE_URI_PATH
      EL_DIR_URI_PATH

 EL_PATH has many cool features not found in PATH. To mention a few:
  • If for some reason you want to read every single file path on your hard disk, you will have a massive memory saving if you use EL_FILE_PATH compared to PATH. If you read the code for `set_parent_path' you will understand why.
  • If you have some  sequentially numbered files on your file system: my-letter.01.doc, my-letter.02.doc, you can easily find the next non-existing path in the sequence with a call to `next_version_path'. It doesn't matter how many digits you are using.
  • Find out if the path exists with a call to `exists'
  • Find the path of a file relative to a parent directory path with `relative_path'
  • Find a file path relative to any directory path even if the directory path argument is not a parent of the file path, with a call to `universal_relative_path'.
  • Of course for compatibility EL_PATH paths are convertible to PATH paths as well as STRING_32.

Check out file-naming in Eiffel-Loop.


Reply all
Reply to author
Forward
0 new messages