[kepler-dev] File exists? actor

Norbert Podhorszki pnorbert at cs.ucdavis.edu
Tue Apr 25 08:21:29 PDT 2006


Hi Christopher,
Thanks for the hint. I forgot that not only String's methods 
but some others can also be used in expressions.
Norbert

On Mon, 24 Apr 2006, Christopher Brooks wrote:

> Hi Norbert,
> Right, DirectoryListing throws an exception if the file cannot be found:
>
> ptolemy.kernel.util.IllegalActionException: Cannot read file
> 'c:/cxh/ptII/ptolemy/actor/lib/io/test/auto/foo'
>  in .<Unnamed Object>.DirectoryListing.directoryOrURL
> Because:
> Cannot read file 'c:/cxh/ptII/ptolemy/actor/lib/io/test/auto/foo' or
> 'c:/cxh/ptII/ptolemy/actor/lib/io/test/auto/foo'
>
> You would need to run DirectoryListing in the parent of directory and
> do some processing.  This sounds gross.
>
> I'm not sure what FileExists is.  There is findFile, which
> can be used in the expression language.
>
> The docs for findFile are at:
> http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII5.0/ptII5.0/doc/codeDoc/ptolemy/data/expr/UtilityFunctions.html
>
> You sometimes see the Expression have a parameter set to
>   eval(readFile(findFile("foo"))),
> See
> ptII/ptolemy/domains/rtp/kernel/test/auto/simpleTest.xml
> or
> ptII/ptolemy/domains/tm/test/auto/FFTTest.xml
>
> _Christopher
> --------
>
      Norbert Podhorszki
    ------------------------------------
      University of California, Davis
      Department of Computer Science
      1 Shields Ave, 2236 Kemper Hall
      Davis, CA 95616
      (530) 754-8188
      pnorbert at cs.ucdavis.edu
      ----------------------------------


More information about the Kepler-dev mailing list