[Pythonmac-SIG] Using slash-seperated paths for creating FSSp ecs (was: Mach-O MacPython IDE!!!)

Schollnick, Benjamin Benjamin.Schollnick@usa.xerox.com
Thu, 27 Dec 2001 08:01:07 -0500


Jack,

> 2. We already have a perfectly well-defined way to specify pathnames
> and their conversion between platform syntaxes: URLs. An
> url2pathname() followed by basejoin() followed by pathname2url()
> should always do the trick.

It appears I've missed some feature creap in Python...

When was url2pathname / pathname2url added?  I'm assuming it's in
URLLIB?

And while I recognize that file://blah/blah/blah.exe is certainly a
path, isn't that forcing us to go through some extra hoops?

I'm not sure (especially since v2.1 Docs don't seem to document
url2pathname, etc) where the url2pathname is simplier.  Don't you still have
the same issues?

> component, the disk name, is magic. Actually, it's also uncertain
> whether it will fly for Mac OS X: the colon-paths start with a disk
> name (which is somewhat magic) while the / path is a standard unix
> path. If you're not on the system disk a path like
> diskname:dirname:filename will become
> /Volumes/diskname/dirname/filename.

That really really is OS dependant (Win2000)
...Oh.... You mean the *drive letter*.

If your constructing from scratch, that might be a issue... But I rarely
construct programs that require me to "assign" a drive.  What I usually do
is something along this line:

program_path = os.getcwd()
file_handle = os.join(program_path, "working_directory")

Plus, I usually use some form of relative path instead of absolute paths.

I think I've started to ramble slightly... Let me sum up.

1) I think I may have missed part of your viewpoint... Because #4
	is obvious to me.... but... >g<

2) Platform Agnostic good... <g> ... It let's us move our programs without 
	having to customize...  (So either way, url2path or using os.join,
	but I think we need to make note of a working method and do our best
	to wrap it in a convience function)

3) I'm afraid that if we move away from a obvious os.join, that we will be
	obscuring our code too much.  (KISS principal at work)

4) I honestly don't think that the programs can make the absolute paths,
	unless they are "custom" programs (or it's in a config file that is
	read).  Yes the code needs to be able to manipulate one, but that
	doesn't mean it has to validate it.

	For example:

		c:\windows\system32\drivers\etc\hosts

		isn't going to automatically be mapped to:

		guyver:system:hosts

	That would require me to examine the code/configuration file,
	or whatever and manually change it.

			- Benjamin
	
-----Original Message-----
From: Jack Jansen [mailto:jack@oratrix.nl]
Sent: Wednesday, December 26, 2001 4:14 PM
To: Schollnick, Benjamin
Cc: 'Donovan Preston'; pythonmac-sig@python.org
Subject: Re: [Pythonmac-SIG] Using slash-seperated paths for creating
FSSp ecs (was: Mach-O MacPython IDE!!!)



Recently, "Schollnick, Benjamin" <Benjamin.Schollnick@usa.xerox.com> said:
> print "path: ", create_platform_path (None)
> print "path: ", create_platform_path ( *["develope"] )
> print "path: ", create_platform_path ( *["develope", "bas_common"] )
> print "path: ", create_platform_path ( *["temp", "delete", "me"] )
> test = ["this", "is", "the", "path"]
> print "path: ", create_platform_path (*test)

I was going to say that I like it too, and I was going to suggest we
drop the idea with the python-dev people for inclusion in all
platforms, but then I started thinking about it a little more and I
realised two things.

1. Something like this will never fly for Windows, where the first
component, the disk name, is magic. Actually, it's also uncertain
whether it will fly for Mac OS X: the colon-paths start with a disk
name (which is somewhat magic) while the / path is a standard unix
path. If you're not on the system disk a path like
diskname:dirname:filename will become
/Volumes/diskname/dirname/filename.

2. We already have a perfectly well-defined way to specify pathnames
and their conversion between platform syntaxes: URLs. An
url2pathname() followed by basejoin() followed by pathname2url()
should always do the trick.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig
++++
www.cwi.nl/~jack        | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig