POV-Ray : Newsgroups : povray.advanced-users : Check for missing include files? Server Time
23 Nov 2024 06:45:52 EST (-0500)
  Check for missing include files? (Message 1 to 4 of 4)  
From: Mike Horvath
Subject: Check for missing include files?
Date: 10 Jul 2019 15:44:10
Message: <5d26400a$1@news.povray.org>
Normally POV-Ray quits with an error if it tries to load an include file 
but it is missing. Is there a way to spawn a warning when this happens, 
and continue with the render? I am trying to track whether this happens 
within a project I am working on, and can't think of a better method.

Thanks.


Michael


Post a reply to this message

From: Mike Horvath
Subject: Re: Check for missing include files?
Date: 10 Jul 2019 15:56:00
Message: <5d2642d0$1@news.povray.org>
On 7/10/2019 3:44 PM, Mike Horvath wrote:
> Normally POV-Ray quits with an error if it tries to load an include file 
> but it is missing. Is there a way to spawn a warning when this happens, 
> and continue with the render? I am trying to track whether this happens 
> within a project I am working on, and can't think of a better method.
> 
> Thanks.
> 
> 
> Michael

I found this in the docs.

     file_exists(S)
     Attempts to open the file specified by the string S. The current
     directory and all library directories specified by the Library_Path
     or +L options are also searched. See Library Paths for details.
     Returns 1 if successful and 0 if unsuccessful.

But it only works if you know the name of the file beforehand. I am 
testing other people's code and there are about 1000 files to check...


Michael


Post a reply to this message

From: jr
Subject: Re: Check for missing include files?
Date: 10 Jul 2019 16:20:01
Message: <web.5d26476bdfe125153936914a0@news.povray.org>
hi,

Mike Horvath <mik### [at] gmailcom> wrote:
> On 7/10/2019 3:44 PM, Mike Horvath wrote:
> > Normally POV-Ray quits with an error if it tries to load an include file
> > but it is missing. Is there a way to spawn a warning when this happens,
> > and continue with the render? I am trying to track whether this happens
> > within a project I am working on, and can't think of a better method.
> > Thanks.
>
> I found this in the docs.
>      file_exists(S)
>      Attempts to open the file specified by the string S. The current
>      directory and all library directories specified by the Library_Path
>      or +L options are also searched. See Library Paths for details.
>      Returns 1 if successful and 0 if unsuccessful.
>
> But it only works if you know the name of the file beforehand. I am
> testing other people's code and there are about 1000 files to check...

with so many files to check, it might be easier to use tools provided by the
system, eg
  $ grep '^#include' /path/to/files/* > todo-list

to get a list of all .inc files.  then you can check either check for their
existence or create dummy files (with only a '#debug
concat("missing-name.inc")'.

(nb the expression given to grep would need to allow for leading and
intermediate spaces)


regards, jr.


Post a reply to this message

From: Mike Horvath
Subject: Re: Check for missing include files?
Date: 10 Jul 2019 16:39:56
Message: <5d264d1c$1@news.povray.org>
On 7/10/2019 4:15 PM, jr wrote:
> hi,
> 
> Mike Horvath <mik### [at] gmailcom> wrote:
>> On 7/10/2019 3:44 PM, Mike Horvath wrote:
>>> Normally POV-Ray quits with an error if it tries to load an include file
>>> but it is missing. Is there a way to spawn a warning when this happens,
>>> and continue with the render? I am trying to track whether this happens
>>> within a project I am working on, and can't think of a better method.
>>> Thanks.
>>
>> I found this in the docs.
>>       file_exists(S)
>>       Attempts to open the file specified by the string S. The current
>>       directory and all library directories specified by the Library_Path
>>       or +L options are also searched. See Library Paths for details.
>>       Returns 1 if successful and 0 if unsuccessful.
>>
>> But it only works if you know the name of the file beforehand. I am
>> testing other people's code and there are about 1000 files to check...
> 
> with so many files to check, it might be easier to use tools provided by the
> system, eg
>    $ grep '^#include' /path/to/files/* > todo-list
> 
> to get a list of all .inc files.  then you can check either check for their
> existence or create dummy files (with only a '#debug
> concat("missing-name.inc")'.
> 
> (nb the expression given to grep would need to allow for leading and
> intermediate spaces)
> 
> 
> regards, jr.
> 
> 


That is a good idea, thanks.


Michael


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.