[squeak-dev] FileDirectory fails

Marcel Taeumel marcel.taeumel at hpi.de
Sun Jun 14 08:20:30 UTC 2020


Hi Subbu.

> On Windows, you need a triple (drive, dirname, entry).

You could treat the "drive" as part of the "dirname", just like the leading "/" on Unix for the root path. The drive letter itself could be treated as a directory. Cygwin does this already (/cygdrive/c/...)

On Windows UNC paths  can be used to denote the "root" in a similar fashion:
 \\?\C:\...

So, every path that begins with "\\" can be treated as root.

Best,
Marcel

Am 14.06.2020 09:49:52 schrieb K K Subbu <kksubbu.ml at gmail.com>:
On 14/06/20 1:52 am, Jakob Reschke wrote:
> Even though the . stands for the current directory (whatever that is),
> still ./foo/bar is a relative path. It cannot be resolved without
> another value (the current or default directory) and is quite literally
> relative to that.
Jakob,

It is not about a path being relative or absolute. Those concepts apply
within the OS filesystem. It is about whether a path specification is
complete or not. On Unix, a path is a pair (dirname, basename/entry). On
Windows, you need a triple (drive, dirname, entry).

Squeak depends on a plugin to access files and needs to give out
*complete* pathnames. Since the vm and plugins share the same OS process
and the CWD (getcwd()) is a property of the OS process, there is no need
for the vm to resolve '.' to CWD before handing it over to the plugin.
In that sense, './foo/bar' is a complete pathname.

On the other hand, the path 'SourcesV50.sources' is incomplete (dirname
missing) and should not be passed to plugin. The image has to resolve
this file in imagePath, vmPath or getcwd() directories before passing it
to the plugin.

Also, an absolute path like '/foo/bar' is an ambiguous object - is it
(/foo/bar, *) or is it (/foo, bar)? Right now, the image treats it like
latter :-( working purely at string level instead of semantic level.

FileDirectory splitName: '/usr/lib' to: [:dirname :basename |
{dirname. basename}] #('/usr' 'lib')

FileDirectory splitName: '/usr/lib/' to: [:dirname :basename |
{dirname. basename}] #('/usr/lib' '')

FileDirectory>>root returns ''. This is to coverup absolute path '/'
being parsed as ('', '/').

Regards .. Subbu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200614/bf5a0c3a/attachment.html>


More information about the Squeak-dev mailing list