Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1751 > unrolled thread

How to get the OS path of a file?

Started byWolfgang Büchel <wolfgang.buechel@gmx.de>
First post2013-12-20 10:00 +0100
Last post2013-12-21 15:55 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.postscript


Contents

  How to get the OS path of a file? Wolfgang Büchel <wolfgang.buechel@gmx.de> - 2013-12-20 10:00 +0100
    Re: How to get the OS path of a file? luser- -droog <mijoryx@yahoo.com> - 2013-12-21 15:55 -0800

#1751 — How to get the OS path of a file?

FromWolfgang Büchel <wolfgang.buechel@gmx.de>
Date2013-12-20 10:00 +0100
SubjectHow to get the OS path of a file?
Message-ID<op.w8dvakdhhytalj@zenon.fritz.box>
I have a PS file (main.ps) in which I include an EPS file (image.eps) with

save
%%BeginDocument: image.eps
%(image.eps) run                (1) or
(path/to/file/image.eps) run    (2)
%%EndDocument
restore

Method (1) works in editor SciTE (path of file image.eps can be
found from ghostscript), but in DOS shell (command.com, Windows 7) I get  
an error message
(No such file or directory) from ghostscript (v.9.10). Method (2) works in  
both cases.

If I wanted to copy the two files to another place I would have to
change the path/to/file in main.ps **by hand**.

Now my question: Does anybody know how to get the path of a file  
**automatically** (from the OS) as a string  that I could use in main.ps?

Wolfgang Buechel

-- 
Erstellt mit Operas E-Mail-Modul: http://www.opera.com/mail/

[toc] | [next] | [standalone]


#1752

Fromluser- -droog <mijoryx@yahoo.com>
Date2013-12-21 15:55 -0800
Message-ID<7a278b1d-848f-4a98-b31e-e823f824c476@googlegroups.com>
In reply to#1751
On Friday, December 20, 2013 3:00:10 AM UTC-6, Wolfgang Büchel wrote:
> I have a PS file (main.ps) in which I include an EPS file (image.eps) with
> 
> save
> %%BeginDocument: image.eps
> %(image.eps) run                (1) or
> (path/to/file/image.eps) run    (2)
> %%EndDocument
> restore
> 
> Method (1) works in editor SciTE (path of file image.eps can be
> found from ghostscript), but in DOS shell (command.com, Windows 7) I get  
> an error message
> (No such file or directory) from ghostscript (v.9.10). Method (2) works in  
> both cases.
> 
> If I wanted to copy the two files to another place I would have to
> change the path/to/file in main.ps **by hand**.
> 
> Now my question: Does anybody know how to get the path of a file  
> **automatically** (from the OS) as a string  that I could use in main.ps?
> 

You could define the path and the filenames separately and 
concatenate them before using. 

I do this in my interpreter's init.ps to locate other data files.
DATA_DIR is just a string containing the pathname.

/strcat {
    2 copy
    length exch length exch 1 index add % a b an bn+an
    string dup 0 6 -1 roll putinterval % b an str
    dup 4 2 roll exch putinterval % (ab)
} bind def

DATA_DIR
(/err.ps) % my path string doesn't end in a slash, so need it here
strcat
run

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web