Re: Re: [svn-commits] r8515 - r3/trunk/binarycloud/node
"B. Kamer" <[email protected]> Sat, 21 May 2005 12:28:13 +0200
| Newsgroups | gmane.comp.lib.binarycloud.devel |
|---|---|
| Message-ID | <[email protected]> |
On May 21, 2005, at 0:16, Jean-Christophe Michel wrote:
> Hi Bas,
>
> I just realize this addition you made is wrong:
> it works only for included ndf placed in WORKSPACE. if you attempt to
> include ndf from vortex/ you get an error :(
>
> Strange, many things seem broken into NdfParser...
> I'll retry tomorrow.
hmm yes, a better idea would perhaps be can modify expand_path()
function to throw an exception (see the @todo)?
Just not sure if it allowed/good practice to throw exception here in
procedural code.
function expand_path($filename) {
if ($filename{0} == '/')
return $filename;
$result = '';
$pathArray = explode(PATH_SEPARATOR, get_include_path());
foreach ($pathArray as $path)
if (file_exists($path . '/' . $filename))
$result = $path . '/' . $filename;
+ else {
+ bc_throw(new BcException(sprintf(/
*#Exception.Binarycloud.FilepathNotExpandable#*/'This bc path (%s)
could not be expanded to a full path', $filename),
'Exception.Binarycloud.PathNotExpandable'));
+ return false;
+ }
}
return $result;
}
and
$expanded_path = expand_path($filename);
if (!bc_catch($e)) {
bc_throw(new BcException(sprintf(/
*#Exception.Node.NdfFileMissing#*/'Node definition file (%s) does not
exists.', $filename), 'Exception.Node.NdfFileMissing'));
return false;
}
or (when it return false on error no throw)
$expanded_path = expand_path($filename);
if ($expanded_path === false) {
bc_throw(new BcException(sprintf(/
*#Exception.Node.NdfFileMissing#*/'Node definition file (%s) does not
exists.', $filename), 'Exception.Node.NdfFileMissing'));
return false;
}
bas
>
> [email protected] wrote:
>
>> Author: bas
>> Date: 2005-05-11 15:07:31 +0100 (Wed, 11 May 2005)
>> New Revision: 8515
>>
>> Modified:
>> r3/trunk/binarycloud/node/NdfContainer.php
>> Log:
>> added exception if ndf does not exists...
>>
>> Modified: r3/trunk/binarycloud/node/NdfContainer.php
>> ===================================================================
>> --- r3/trunk/binarycloud/node/NdfContainer.php 2005-05-11
>> 13:09:55 UTC (rev 8514)
>> +++ r3/trunk/binarycloud/node/NdfContainer.php 2005-05-11
>> 14:07:31 UTC (rev 8515)
>> @@ -89,6 +89,11 @@
>> $timer =& Timer::getInstance();
>> $timer->start("binarycloud.LoadNdf($filename)");
>>
>> + if (!file_exists(BC_PATH_WORKSPACE . '/' . $filename)) {
>> + bc_throw(new BcException(sprintf('Node definition
>> file (%s) does not exists.', BC_PATH_WORKSPACE . '/' . $filename),
>> 'Ndf.NdfDoesNotExists'));
>> + return false;
>> + }
>> +
>> if ($this->cache_mode == BC_NDF_NOCACHE) {
>> /* Caching is disabled, we simply create a parser. We
>> have to store
>> * a stack of parsers since NDF files can include NDF
>> files
>>
>
> --
> Jean-Christophe Michel
> _______________________________________________
> dev mailing list
> dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
> http://lists.binarycloud.com/mailman/listinfo/dev
>
>
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev