Groups > Superbase > Superbase NG > Re: deletefile




deletefile

deletefile
Fri, 10 Aug 2007 12:19:52 -040
I could not make delete file work.  The entry objects never matched,
even though the file names did.  I modified it and changed name as
below to work, 

-Dan
 
function deletesbmfile(string filename, integer error) export
  boolean found
  integer e, i
  string sEntryFileName, sEntry2FileName  <<<<<<<<
  UTOSdirectory dir
  UTOSdirectoryentry entry, entry2

  e = 0
  entry =@ UTOSdirectoryentry.new(filename, e)
  if entry =@= .nul
    error = e
  else
    sEntryFileName = entry.name <<<<<<<<<<
    dir =@ entry.getdirectory(error=e)
    if dir =@= .nul
      error = e
    else
      i = 1
      found = .false
      while i <= dir.entrycount
        entry2 =@ dir.getentry(i, error=e) <<<<<<<<<
        sEntry2FileName = entry2.name <<<<<<<<<
        if sEntry2FileName == sEntryFileName
<<<<<<<<<
          found = .true
        else
          i = i + 1
        end if
      end while found or e
      if found
        dir.deleteentry(i, error=e)
      end if
    end if
  end if
Post Reply
Re: deletefile
Thu, 20 Sep 2007 14:06:14 -040
Thanks John.

On Fri, 21 Sep 2007 01:22:24 +0800, "John Roberts"
<remjohnr@iinet.net.au> wrote:
>
>Dan
>This is the line that was at fault
>if entry =@= dir.getentry(i, error=e)
>it should read as below:
> if entry == dir.getentry(i, error=e)
>
>UTOSdirectoryentryvar entry returns a string value containing the file 
>path\name.ext as does getentry() hence no @
>Cheers, John 
>
Post Reply
Re: deletefile
Fri, 21 Sep 2007 01:22:24 +080
"Dan Jinks" <dan@jinksincNOSPAM.com> wrote in message 
news:ko3pb35m56s3ricuc3gp3cibsd184t9mot@4ax.com...
>I could not make delete file work.  The entry objects never matched,
> even though the file names did.  I modified it and changed name as
> below to work,
>
> -Dan
>
> function deletesbmfile(string filename, integer error) export
>  boolean found
>  integer e, i
>  string sEntryFileName, sEntry2FileName  <<<<<<<<
>  UTOSdirectory dir
>  UTOSdirectoryentry entry, entry2
>
>  e = 0
>  entry =@ UTOSdirectoryentry.new(filename, e)
>  if entry =@= .nul
>    error = e
>  else
>    sEntryFileName = entry.name <<<<<<<<<<
>    dir =@ entry.getdirectory(error=e)
>    if dir =@= .nul
>      error = e
>    else
>      i = 1
>      found = .false
>      while i <= dir.entrycount
>        entry2 =@ dir.getentry(i, error=e)
<<<<<<<<<
>        sEntry2FileName = entry2.name <<<<<<<<<
>        if sEntry2FileName == sEntryFileName
<<<<<<<<<
>          found = .true
>        else
>          i = i + 1
>        end if
>      end while found or e
>      if found
>        dir.deleteentry(i, error=e)
>      end if
>    end if
>  end if
> end function

Dan
This is the line that was at fault
if entry =@= dir.getentry(i, error=e)
it should read as below:
 if entry == dir.getentry(i, error=e)

UTOSdirectoryentryvar entry returns a string value containing the file 
path\name.ext as does getentry() hence no @
Cheers, John 

Post Reply
Re: deletefile
Fri, 05 Oct 2007 10:44:54 +010
John Roberts wrote:
> 
> Neil
> On my 4e installation this is not fixed in filesyslib\function 
> deletefile(string filename, integer error) export.

Sorry. I just fixed it in my own again and made sure that it will get
across to the distribution on the next round.

Post Reply
Re: deletefile
Fri, 5 Oct 2007 15:31:48 +0800
"Dan Jinks" <dan@jinksincNOSPAM.com> wrote in message 
news:mjd5f352d93jhhtpfk6nj660t5vc3topol@4ax.com...
> Thanks John.
>
> On Fri, 21 Sep 2007 01:22:24 +0800, "John Roberts"
> <remjohnr@iinet.net.au> wrote:
>>
>>Dan
>>This is the line that was at fault
>>if entry =@= dir.getentry(i, error=e)
>>it should read as below:
>> if entry == dir.getentry(i, error=e)
>>
>>UTOSdirectoryentryvar entry returns a string value containing the file
>>path\name.ext as does getentry() hence no @
>>Cheers, John
>>

Neil
On my 4e installation this is not fixed in filesyslib\function 
deletefile(string filename, integer error) export.
John 

Post Reply
about | contact