Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Getting the file name in a package

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52919] Re: Getting the file name in a package
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 17 Dec 2004 05:18:26 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <cpri7j$qsd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

what may ContextToFileName[] do ?
BTW a package can be in a notebook and does not
need a file name.

Regards
  Jens

"Geronimo" <kalymereauKILLSP at Myahoo.fr> schrieb im Newsbeitrag 
news:cpri7j$qsd$1 at smc.vnet.net...
> Hi
>
> I have a package (.m) that produces some output in an external file. As 
> the
> computation is quite long, I would like to avoid it if the output file is
> more recent than the last modification of the package (since the output
> only depends on what is in the package).
>
> So I need to extract the file name of the package within itself (and then
> test the date with FileDate). As the context name is related to the file
> name, I use:
>
>
> BeginPackage["TestPack`"]
>
> (blabla)
>
> Begin["`Private`"]
>
> currentFileName = StringDrop[Context[], -9] <> ".m"
>
> (blabla)
>
> End[]
>
> EndPackage
>
> Since within the Private context the Context[] command gives
> TestPack`Private` and `Private` is 9 characters long, it works:
> currentFileName is equal to "TestPack.m". However I find this solution
> quite cumbersome, is there a more obvious way to do that?
>
> Thank you
>
> Geronimo
>
>
> 



  • Prev by Date: Re: plotting two functions on the one graph
  • Next by Date: Re: Getting the file name in a package
  • Previous by thread: Getting the file name in a package
  • Next by thread: Re: Getting the file name in a package