Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002505OCamlOCaml generalpublic2004-04-25 18:192013-08-31 12:46
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionsuspended 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0002505: Filename.root_dir_name?
DescriptionHi,

it seems that the function "root_dir_name" is missing in module
"Filename". The problem is that if I want to decompose a path using
successive applications of "dirname", I want to compare the current
directory to either "." or "/" on Unix-systems to detect the base
case. Unfortunately, we only have "current_dir_name" for ".", but not
"root_dir_name" for "/" (or whatever it is on other systems), which may
make it difficult to write portable code.

Regards
Markus

--
Markus Mottl http://www.oefai.at/~markus [^] markus@oefai.at

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000214)
administrator (administrator)
2004-04-29 14:25

> it seems that the function "root_dir_name" is missing in module
> "Filename". The problem is that if I want to decompose a path using
> successive applications of "dirname", I want to compare the current
> directory to either "." or "/" on Unix-systems to detect the base
> case. Unfortunately, we only have "current_dir_name" for ".", but not
> "root_dir_name" for "/" (or whatever it is on other systems), which may
> make it difficult to write portable code.

Hi Markus,

My first Unix-based reflex would be to say that the root directory is the
directory which is equal to its own dirname.

The problem I see with "root_dir_name": I don't think there is such a
thing in Windows. More precisely, each drive is a root by itself, so
there are more than one root directory. I think my dirname trick
would work under Windows (but I have not checked).

If you can tell me what it should do under Windows, I'll file this as a
feature wish.

-- Damien
(0000215)
administrator (administrator)
2004-04-29 15:15

Hi Damien,

On Thu, 29 Apr 2004, Damien Doligez wrote:
> My first Unix-based reflex would be to say that the root directory is the
> directory which is equal to its own dirname.

Unfortunately not: dirname current_dir_name = current_dir_name

So it's not only the root directory "/" that has this property.

> The problem I see with "root_dir_name": I don't think there is such a
> thing in Windows. More precisely, each drive is a root by itself, so
> there are more than one root directory. I think my dirname trick
> would work under Windows (but I have not checked).
>
> If you can tell me what it should do under Windows, I'll file this as a
> feature wish.

Oh well, I can only hope that Microsoft drops this outdated concept of
having drives instead of logical directory trees...

Anyway, I had thought that e.g. "C:\" denotes that root directory of
drive "C", and "C:" refers to the current directory in "C". So maybe
"\" does the trick? I haven't used Windows for years so I can't tell...

Regards,
Markus

--
Markus Mottl http://www.oefai.at/~markus [^] markus@oefai.at

(0006837)
doligez (administrator)
2012-01-27 21:45

We still don't know what "the" root might be under windows. Moreover, when you decompose with Filename.dirname, the base case is when the result is equal to the argument. Then if Filename.is_relative is true, you are in the "." case; if it's false you are in the root case.

I don't think we can do better than that.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2012-01-27 21:45 doligez Note Added: 0006837
2012-01-27 21:45 doligez Status acknowledged => resolved
2012-01-27 21:45 doligez Resolution open => suspended
2012-01-27 21:45 doligez Description Updated View Revisions
2013-08-31 12:46 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker