A couple small problems

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

A couple small problems

Post by pwdiener »

I've discovered a couple small problems w/ the file_open built-in macro function. It appears that in spite of returning a bool (which I assume indicates success) that the function just fails quietly when it thinks the specified file does not exist, but reports success. I say "it thinks", because the second issue is that it does not appear to find files with .. in the path.

I was using the LUA code
local FileB = macro_tag("$FB")
local PSFName = macro_tag("$FDD").."..\\"..FileB..".psf"
local fop = file_open(PSFName)
if not fop then
message("Can't find PSF file "..PSFName)
beep()
return
end
to open a file related to the file I was editing, but got no error message but also no file opened. When I changed the line to:
local PSFName = string.sub(macro_tag("$FDD"),1,- 8 )..FileB..".psf"
it worked fine. The second version strips "Source\" off the end of $FDD so there is no need for the parent directory reference.

This was on 3.96q beta 8 - I haven't had a chance to verify it on my install of 3.96q at work.

Not exactly show stoppers... :?

Bill
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Bill,

If you change this line of code:

Code: Select all

    if not fop then
to read as this:

Code: Select all

    if fop == 0 then
or this:

Code: Select all

    if fop ~= 1 then
then the macro works as expected :)

NOTE: The function definitely returns 0 on error and 1 on success.

So I am not 100% sure, but this looks like a but in the Lua not operator :?

In any case the file_open macro function has also been cleaned up a little bit ;)

Cheers Jussi
Post Reply