Well after much experimenting, I've come up with a solution that still doesn't work, although I think it should. (To see the actual problem I'm having, skip down to the code).

To summarize:
The problem:
The palm normally loads programs from the sdcard into the palm's main memory to run, and then the palm delete's it once the program is finished.
The program cannot delete itself from main memory while it's running.
If the palm is reset while the code is running it stays in main memory. (A palm bug)

Solution:
We have a second piece of code (the loader) that normally sits on the sdcard. When the loader is run it checks to see if the program is in the palm's main memory,
and if so, compares it to what's on the sdcard.
if the sdcard is different, the loader deletes the copy in main memory and then copies the one from the sdcard into the main memory and then runs it.
if the sdcard has the same one, it just runs the one in the main memory.
The main memory program would also do the same check, and if it's not the same as what's on the sdcard, would run the loader, which would then update the main memory. The main memory program would also check that any stray copies of the Launcher program are not in main memory and delete those as well.

In this way the main memory program is always in sync with the data that's on the sdcard.

I think this should work, except I can't delete the program in main memory. The following code says it works...

 // first delete the old one
 err = DmDeleteDatabase(0, OldLid);
 while (err==dmErrDatabaseProtected)
 {
err = DmDatabaseProtect (0,OldLid,false); // remove protection and try again
  err = DmDeleteDatabase(0, OldLid);
   // this loop seems to work, went through once.
 }
 if (err)
   {
    ShowErrorStr(err);
  return false;
 }

no errors up to this point, but

 // now create a new one from the sdcard
  LocalID newLid;
  err = VFSImportDatabaseFromFile(volRefNum, path, &cardNo, &newLid);

This gives the error that the database already exists. (dmErrAlreadyExists)

I'm stuck.

Chris Bruner
Compulife Software Inc.
==============================================
----- Original Message ----- From: "cbruner" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Tuesday, November 08, 2005 6:19 PM
Subject: Re: deleting a program currenty on the palm


Wow, I fell asleep this afternoon and when I woke up there was a dozen thoughtful answers. Very cool.

I'm going to have to experiment with some of these solutions, (and any more that might popup). Thank you all for your time and thoughts.

Chris Bruner
Compulife Software Inc.
==============================================
----- Original Message ----- From: "John Sutton" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Tuesday, November 08, 2005 12:07 PM
Subject: RE: deleting a program currenty on the palm


Bob said...
Using the recyclable bit would clean it up as soon as the user
switches to another app, or upon reset, right?
Just out of curiousity, if you did find a version mismatch and set this
recyclable bit, would it clean it up and get the fresh version back from
the sdcard if you were to relaunch yourself with SysUIAppSwitch?

--
For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/

--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/



--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/




--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to