Re: Path to *.m file
- To: mathgroup at smc.vnet.net
- Subject: [mg86476] Re: Path to *.m file
- From: Albert Retey <awnl at arcor.net>
- Date: Wed, 12 Mar 2008 00:12:39 -0500 (EST)
- References: <fr0cr7$ekp$1@smc.vnet.net> <fr2mei$o2t$1@smc.vnet.net> <fr5e8e$odd$1@smc.vnet.net>
Hi, > I too would like a way to determine the path of a .m file while it is > being loaded by Get. None of the replies provide a fool-proof way of > doing this (e.g. in the not unusual case that you have two files with > the same name in different directories). I absolutely agree with your wish that this information should be available without any hacking but I think that there is no way to load a file with Get which is not the first in FileNames[filename,$Path] unless you use an absolute path for filename. The latter is easy to handle and covered with the else condition in: Catch[If[ FileType[$Input]=!=File, First[FileNames[$Input,$Path]/.{}:>Throw[$Failed]], $Input ]] so I think the above construct should work for the case you named. > It would be nice if Wolfram > Research added this to their 'to do' list! I'm sure you have seen the post of Carl Woll about an undocumented private variable that holds that information. Looks like the people at Wolfram found this information valuable, too, so it probably is only a small effort to provide that information to the users/package developers without hacks and workarounds. Sorry for the post with only marginal new information but maybe keeping the thread alive convinces someone that we really want that little information accessible :-) albert