Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Twitter Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Request an Evaluation
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 15 Professional
Maple 15 Academic
Maple 15 Student Use
What's New in Maple 15
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes

Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Maple Home
Maple 15 Professional
Maple 15 Academic
Maple 15 Student Use
What's New in Maple 15
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes and
Connectors


Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
Maple Features
The Maple Reporter Online

Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

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

Search email archive for  

[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



Ready to buy?

For more pricing information:
Visit our webstore, call us on +1 800 724 8380 or email us at info@adeptscience.com

Featured Downloads

Maple 15 & MapleSim 5 Professional Brochure
Maple 15 Academic Datasheet
Maple 15 & MapleSim 5 Brochure - Academic Brochure
Maple 15 New Features data sheet
Maple 15 New Features - Flyer
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper: Technological Superiority in Multi-Domain Physical Modeling and Simulation

Latest Downloads

Maple Case Study: The Changing Face of Robotics
Maple Application Brief - Analyse the Path of a Liquid-Handling Robot
Maple Player for iPad - App
Maple Player for iPad - Datasheet
Case Study - Multi-Domain Modelling Critical to Unmanned Vehicle Designs

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks

Latest News

NASA’s Jet Propulsion Laboratory begins widespread adoption of Maplesoft technology
NASA’s Jet Propulsion Laboratory begins widespread adoption of Maplesoft technology
Latest release marks the 10th anniversary of Maple T.A.
Maple Case Study: The Changing Face of Robotics
Maple Application Brief - Analyse the Path of a Liquid-Handling Robot
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2012, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055