List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Mac/Unix/Win platform independent pathnames
| [MUG] Mac/Unix/Win platform independent pathnames |
|
Author: Denis Pollney
Posted: 26/09/2000 11:09:14 GDT
|
>> From: Denis Pollney
Hi Everybody,
How can I specify a pathname in maple in a system-independent manner?
I've noticed that using Maple6 on a Macintosh G4, the Unix-style "/"
is not interpreted as a sub-directory delimeter. Thus, the commands
> a := 1;
> save a, "/tmp/test.mpl";
results in a file called (literally) /tmp/test.mpl being created in
Maple's current working directory.
Has this behaviour changed with Maple6? I don't have very much
experience with Macs, but I have at times run MapleV.5 on them and I
don't recall this being an issue. I don't have a Mac version of V.5
handy in order to test this.
The ?filename help page refers to a `canonical' form of a filename,
but does not describe it very clearly. Is this documented anywhere?
(I posted this question to comp.soft-sys.math.maple last week, so
apologies to anyone who is coming across this twice.)
Thanks for any information,
Denis.
----------------------------------------------------------------------
Denis Pollney
Max-Planck-Institut fuer Gravitationsphysik +49-331-567-7263
Albert Einstein Institut, Am MuehlenBerg 5, D-14476, Golm, Germany
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: William Kirkham
Posted: 10/10/2000 03:44:57 GDT
|
>> From: "William Kirkham"
I get the same results on a Mac G3 running Maple V R4. I didn't find any
obvious method of determining the system in use, but one could implement a
specific method for each system desired if the operating system could be
determined.
--Bill
-----
William J. Kirkham, P.E.
----------
|>> From: Denis Pollney
| How can I specify a pathname in maple in a system-independent manner?
|
| I've noticed that using Maple6 on a Macintosh G4, the Unix-style "/"
| is not interpreted as a sub-directory delimeter. Thus, the commands
|
|> a := 1;
|> save a, "/tmp/test.mpl";
|
| results in a file called (literally) /tmp/test.mpl being created in
| Maple's current working directory.
|
| Has this behaviour changed with Maple6? I don't have very much
| experience with Macs, but I have at times run MapleV.5 on them and I
| don't recall this being an issue. I don't have a Mac version of V.5
| handy in order to test this.
|
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: Maple Group
Posted: 13/10/2000 16:20:33 GDT
|
Subject: Mac/Unix/Win platform independent pathnames
To:
Date: Tue, 10 Oct 2000 18:17:09 +0200 (MET DST)
may be :
kernelopts(bytesalloc,bytesused,level,version);
gives:
11401176, 239250024, 2, Maple V, Release 5.1, APPLE_PPC_MAC, Aug \
20 1998, HYB-51NC-425603-7
is what you are looking for
--
Jean-Louis Colot, cp 234
Calcul Symbolique sur Ordinateur
CSO, Bd du Triomphe,
Universite Libre de Bruxelles
B-1050 Bruxelles
32-2-6505514,32-2-6505996, fax 32-2-6505113
e-mail:
e-mail groupe cso:
local: 2N4 211, batiment NO (math-phys) Campus Plaine
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Tue, 10 Oct 2000 10:49:36 -0400
From: bauldrywc
Subject: Mac/Unix/Win platform independent pathnames
To: "William Kirkham,"
Bill,
The Maple 6 call "kernelopts(platform)" returns the system you're running
on. See the kernelopts help screen for all the current platform strings.
In Maple V, you can use a little routine:
Platform := proc()
local st, p, rng;
st := kernelopts(version);
p := 1 + searchtext(",", st)+1;
p := p + searchtext(",", st, p..-1);
rng := p .. (p - 2 + searchtext(",", st, p..-1));
RETURN(substring(st, rng));
end:
It's unfortunate that DOS, Unix, and Mac's all use different delimiters
in paths.
Regards,
Bill
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: Denis Pollney
Posted: 19/10/2000 08:45:06 GDT
|
>> From: Denis Pollney
Hi Everybody,
I agree that in principle, one could use kernelopts() to determine
the platform on which you are running and then write your own function
to build platform-specific pathnames based on that.
However, isn't this something that maple used to do itself
automatically? In early versions of maple (V.2 at least) there
was a convert(...,hostfile) command with which you could explicitly
convert a filename to the parent filesystem's format. This was removed
in V.3 and subsequent versions, I believe because the reading/writing
functions were modified to incorporate this conversion automatically.
Now, in Maple6 on a Mac, I find that this conversion is not carried
out.
My questions are:
- Has this behaviour really changed for Maple6? I haven't found such
a change documented anywhere, and I don't have a V.5/Mac handy
to confirm a difference.
- Is the only solution to the problem for me to hand-code a routine
that already existed in V.2 (and implicitly in V.3-V.5).
- In the Maple6 ?filename help page, a `canonical' filename is
mentioned but not explained. What is the purpose of a canonical
filename and what are the rules for building one?
Thanks in advance for any tips,
Denis.
|>> From: Denis Pollney
| How can I specify a pathname in maple in a system-independent manner?
|
| From: (Colot J.-L.)
| may be :
|
| kernelopts(bytesalloc,bytesused,level,version);
|
| gives:
|
| 11401176, 239250024, 2, Maple V, Release 5.1, APPLE_PPC_MAC, Aug \
| 20 1998, HYB-51NC-425603-7
|
| is what you are looking for
|
----------------------------------------------------------------------
Denis Pollney
Max-Planck-Institut fuer Gravitationsphysik +49-331-567-7263
Albert Einstein Institut, Am MuehlenBerg 5, D-14476, Golm, Germany
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: Dr Francis J Wright
Posted: 30/10/2000 11:11:31 GMT
|
>> From: "Dr Francis J. Wright"
Denis Pollney wrote:
> - In the Maple6 ?filename help page, a `canonical' filename is
> mentioned but not explained. What is the purpose of a canonical
> filename and what are the rules for building one?
I believe that this relates only to directory separators. The canonical
separator is /, as for UNIX, which is automatically mapped by Maple to
whatever is appropriate for the actual OS. I don't think there is any
canonical way to express any other aspects of the filestore structure,
such as the driver letters used by Microsoft systems, because there is
no well-defined way to map such aspects to another OS. Drive letters
are not even portable between two machines running the same Microsoft OS
unless you know that they have identical setups. So I see no
alternative but to leave this as a user configuration requirement.
Francis
--
Dr Francis J. Wright | mailto:
School of Mathematical Sciences | tel: (020) 7882 5453 (direct)
Queen Mary, University of London | fax: (020) 8981 9587 (dept.)
Mile End Road, London E1 4NS, UK | http://centaur.maths.qmw.ac.uk/
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: Andrzej Pindor
Posted: 02/11/2000 16:02:58 GMT
|
>> From: Andrzej Pindor
----- Begin Included Message -----
>> From: "Dr Francis J. Wright"
Denis Pollney wrote:
> - In the Maple6 ?filename help page, a `canonical' filename is
> mentioned but not explained. What is the purpose of a canonical
> filename and what are the rules for building one?
I believe that this relates only to directory separators. The canonical
separator is /, as for UNIX, which is automatically mapped by Maple to
whatever is appropriate for the actual OS.
....................................
----- End Included Message -----
I have discoverd that under Windows this does not work for the command "system".
For instance
> system("mkdir c:/my_dir/lib");
will not create the desired subdirectory "lib" even though the command returns
"0", pretending that it worked fine. You have to use:
> system("mkdir c:\\my_dir\\lib");
Andrzej
--
Dr. Andrzej Pindor The foolish reject what they see and not what
University of Toronto think; the wise reject what they think and not
Information Commons what they see. Huang Po
Phone: (416) 978-5045 Fax: (416) 978-7705
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: Robert Israel
Posted: 06/11/2000 19:03:42 GMT
|
>> From: Robert Israel
On Thu, 2 Nov 2000, Andrzej Pindor wrote:
> I have discoverd that under Windows this does not work for the command
"system".
> For instance
> > system("mkdir c:/my_dir/lib");
> will not create the desired subdirectory "lib" even though the command returns
> "0", pretending that it worked fine. You have to use:
> > system("mkdir c:\\my_dir\\lib");
My understanding is that "system" passes along its argument as-is to the
operating system (subject to the interpretation of \ as an escape
character). Maple doesn't try to parse the string, and can't know
what the operating system will do with it. In particular it doesn't know
what part of the string might be a file name, and doesn't do any
translation between directory-separator characters.
BTW, on my computer (running Windows NT 4.0),
system("mkdir c:/my_dir/lib");
returned 1. If it returns 0 on yours, that's a Windows problem, not a
Maple problem.
Robert Israel
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
|
| [MUG] Re: Mac/Unix/Win platform independent pathnames |
|
Author: Willard, Daniel Dr DUSA-OR
Posted: 10/11/2000 20:30:30 GMT
|
>> From: "Willard, Daniel Dr DUSA-OR"
Funny. The first time I tried the second version (with my Windows NT,
mapleV5.1) I got 0 and a screen flash and an empty instruction line followed
by a 0 result too! But on repetitions, (following "restart" or a total
restart) i always got a 1 or possibly a second 1 following a flash and a
blank instruction line (as I got the first time). But I did get a my_dir
with a sub-directory lib in my c directory. And after I erased the my_dir
from the c directory, I could get the two 0s again. How about that?
-----Original Message-----
From: Robert Israel
Sent: Monday, November 06, 2000 2:04 PM
To:
Subject: [MUG] Re: Mac/Unix/Win platform independent pathnames
>> From: Robert Israel
On Thu, 2 Nov 2000, Andrzej Pindor wrote:
> I have discoverd that under Windows this does not work for the command
"system".
> For instance
> > system("mkdir c:/my_dir/lib");
> will not create the desired subdirectory "lib" even though the command
returns
> "0", pretending that it worked fine. You have to use:
> > system("mkdir c:\\my_dir\\lib");
My understanding is that "system" passes along its argument as-is to the
operating system (subject to the interpretation of \ as an escape
character). Maple doesn't try to parse the string, and can't know
what the operating system will do with it. In particular it doesn't know
what part of the string might be a file name, and doesn't do any
translation between directory-separator characters.
BTW, on my computer (running Windows NT 4.0),
system("mkdir c:/my_dir/lib");
returned 1. If it returns 0 on yours, that's a Windows problem, not a
Maple problem.
Robert Israel
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
|
Previous by date: [MUG] Re: Very limited Stack Size in Windows Version, Heike Koch-Beuttenmueller
Next by date: [MUG] 10 digit number Maple can't factor, Ken W Smith
Previous thread: [MUG] Missing plot graphics, Pete
Next thread: [MUG] 10 digit number Maple can't factor, Ken W Smith
|