In OS X, pathnames have two distinct syntaxes. The GUI uses the pre-X syntax, in which a pathname begins with a volume name and the separator is `:', as in Macintosh HD:Users:ham:Documents:whatever.hs In the Darwin (i.e., unix) command-line "underworld", a pathname begins with /Volumes, spaces are escaped with `\', and the separator is `/', as in /Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs When you drag a file icon onto the command line, Terminal does the right thing-- it converts the pathname from the GUI syntax to the Darwin syntax, and utilities such as more work just as they should. Hugs, however, doesn't do so well. For example, Prelude> :l /Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs Reading file "/Volumes/Macintosh\": ERROR "/Volumes/Macintosh\" - Unable to open file "/Volumes/Macintosh\" Quoting the pathname changes the problem, but doesn't cure it: Prelude> :l "/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs" ERROR - Missing `\' terminating string literal gap Apparently what's confusing Hugs is the `\', because removing it cures the problem: Prelude> :l "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs" Reading file "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs": Is this problem unavoidable, or is it just an oversight? Thanks, --Ham -- ------------------------------------------------------------------ Hamilton Richards Department of Computer Sciences Senior Lecturer Mail Code C0500 512-471-9525 The University of Texas at Austin Taylor Hall 5.138 Austin, Texas 78712-1188 ham@cs.utexas.edu hrichrds@swbell.net ------------------------------------------------------------------
Hamilton Richards wrote:
In OS X, pathnames have two distinct syntaxes. The GUI uses the pre-X syntax, in which a pathname begins with a volume name and the separator is `:', as in
Macintosh HD:Users:ham:Documents:whatever.hs
In the Darwin (i.e., unix) command-line "underworld", a pathname begins with /Volumes, spaces are escaped with `\', and the separator is `/', as in
/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs
When you drag a file icon onto the command line, Terminal does the right thing-- it converts the pathname from the GUI syntax to the Darwin syntax, and utilities such as more work just as they should.
Hugs, however, doesn't do so well. For example,
Prelude> :l /Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs Reading file "/Volumes/Macintosh\": ERROR "/Volumes/Macintosh\" - Unable to open file "/Volumes/Macintosh\"
Quoting the pathname changes the problem, but doesn't cure it:
Prelude> :l "/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs" ERROR - Missing `\' terminating string literal gap
Apparently what's confusing Hugs is the `\', because removing it cures the problem:
Prelude> :l "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs" Reading file "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs":
Is this problem unavoidable, or is it just an oversight?
The backslash isn't actually part of the pathname; it's added to
prevent the shell from splitting the pathname into multiple arguments.
The shell converts the backslash-space sequence into a space.
The same issue arises in other languages; e.g. in C,
const char *name = "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs";
FILE *fp = fopen(name, "r");
would work, but including the backslash would break it.
--
Glynn Clements
I originally wrote:
In OS X, pathnames have two distinct syntaxes. The GUI uses the pre-X syntax, in which a pathname begins with a volume name and the separator is `:', as in
Macintosh HD:Users:ham:Documents:whatever.hs
In the Darwin (i.e., unix) command-line "underworld", a pathname begins with /Volumes, spaces are escaped with `\', and the separator is `/', as in
/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs
When you drag a file icon onto the command line, Terminal does the right thing-- it converts the pathname from the GUI syntax to the Darwin syntax, and utilities such as more work just as they should.
Hugs, however, doesn't do so well. For example,
Prelude> :l /Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs Reading file "/Volumes/Macintosh\": ERROR "/Volumes/Macintosh\" - Unable to open file "/Volumes/Macintosh\"
Quoting the pathname changes the problem, but doesn't cure it:
Prelude> :l "/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs" ERROR - Missing `\' terminating string literal gap
Apparently what's confusing Hugs is the `\', because removing it cures the problem:
Prelude> :l "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs" Reading file "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs":
Is this problem unavoidable, or is it just an oversight?
At 6:02 AM +0100 9/1/02, Glynn Clements replied:
The backslash isn't actually part of the pathname; it's added to prevent the shell from splitting the pathname into multiple arguments. The shell converts the backslash-space sequence into a space.
The same issue arises in other languages; e.g. in C,
const char *name = "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs"; FILE *fp = fopen(name, "r");
would work, but including the backslash would break it.
-- Glynn Clements
I do actually understand that the backslash isn't part of the pathname. My question is whether there's any reason Hugs couldn't treat backslashes in its command line as C shells do. I suspect it's just something no one thought about, because spaces are uncommon in unix file names. --Ham -- ------------------------------------------------------------------ Hamilton Richards Department of Computer Sciences Senior Lecturer The University of Texas at Austin 512-471-9525 1 University Station C0500 Taylor Hall 5.138 Austin, Texas 78712-1188 ham@cs.utexas.edu hrichrds@swbell.net ------------------------------------------------------------------
Hi,
thanks for the report. The upcoming release fixes this
usability issue, treating "\ " as " " in filenames (only.)
--sigbjorn
----- Original Message -----
From: "Hamilton Richards"
In OS X, pathnames have two distinct syntaxes. The GUI uses the pre-X syntax, in which a pathname begins with a volume name and the separator is `:', as in
Macintosh HD:Users:ham:Documents:whatever.hs
In the Darwin (i.e., unix) command-line "underworld", a pathname begins with /Volumes, spaces are escaped with `\', and the separator is `/', as in
/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs
When you drag a file icon onto the command line, Terminal does the right thing-- it converts the pathname from the GUI syntax to the Darwin syntax, and utilities such as more work just as they should.
Hugs, however, doesn't do so well. For example,
Prelude> :l /Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs Reading file "/Volumes/Macintosh\": ERROR "/Volumes/Macintosh\" - Unable to open file "/Volumes/Macintosh\"
Quoting the pathname changes the problem, but doesn't cure it:
Prelude> :l "/Volumes/Macintosh\ HD/Users/ham/Documents/whatever.hs" ERROR - Missing `\' terminating string literal gap
Apparently what's confusing Hugs is the `\', because removing it cures the problem:
Prelude> :l "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs" Reading file "/Volumes/Macintosh HD/Users/ham/Documents/whatever.hs":
Is this problem unavoidable, or is it just an oversight?
Thanks,
--Ham
At 4:47 PM -0700 10/7/02, Sigbjorn Finne wrote:
Hi,
thanks for the report. The upcoming release fixes this usability issue, treating "\ " as " " in filenames (only.)
Many thanks for attending to this issue. It's a minor one, but since the new release came out it has made my life pleasanter. --Ham -- ------------------------------------------------------------------ Hamilton Richards Department of Computer Sciences Senior Lecturer The University of Texas at Austin 512-471-9525 1 University Station C0500 Taylor Hall 5.138 Austin, Texas 78712-1188 ham@cs.utexas.edu hrichrds@swbell.net ------------------------------------------------------------------
participants (4)
-
Glynn Clements -
Hamilton Richards -
Hamilton Richards -
Sigbjorn Finne