Windows error 32 - SOLVED

Walt Brown walter.h.brown at gmail.com
Sun Dec 19 02:07:49 EST 2010


I have run into many (non-LC) issues in Windows where various apps and OS
components either take their time removing any flags on folders and files,
or not at all. I think it has something to do with dynamic Registry settings
and OS housekeeping - I am not an expert in that area, this is a hypothesis
from observation...

-----Original Message-----
From: use-livecode-bounces at lists.runrev.com
[mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Richard Gaskin
Sent: Saturday, December 18, 2010 10:15 AM
To: How to use LiveCode
Subject: Re: Windows error 32 - SOLVED

If any of you ever need to do anything like this, the solution turned out to
be quite simple:

I noticed that I could use the same "delete folder" command from within LC
to delete the folder in question, just not from the app that originates in
the problem folder.

Since the OS error is 32 (obtained from LC's sysError function, a godsend
for anything related to file I/O), it occurred to me that the issue is that
the deletion process is beginning with an app that resides in that folder,
and therefore is using that folder as the current working directory.
Apparently, even though it quits before the copy in temp takes over, because
the original copy in that application folder is what launched the app in
temp, the current working directory had not changed, and the OS was simply
doing its job of preserving objects in use.

So the fix is a one-liner, added just before the original app launches the
copy in the temp folder:

   set the directory to tTempFolder

tTempFolder is obtained with LC's specialFolderPath("temporary"), and used
to create the file name of the copy of the app that does the actual
uninstall.

By changing the working directory before launching the copy, the original
folder in Program Files is now free to be deleted.  Works a treat.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

Yesterday I wrote:

> I'm making an uninstaller for one of my apps on Windows, and 
> everything's working swell except for one detail:
>
> I can delete all files and folders related to the install with ease, 
> but when I try to delete the application folder sysError returns 32, 
> which means it's in use by another process.
>
> Here's the setup:
>
> The uninstaller works as we're required to do on Windows: when 
> launched it makes a copy of itself into the temp folder, and launches 
> that copy after which the original quits.  We have to do that because 
> of course an app can't delete itself.  The copy has the UI that the 
> user clicks to start the uninstall.
>
> That copy in temp works great, and clears out everything, even the 
> original uninstaller that launched it.
>
> The one thing it can't do is delete the folder the app was originally 
> in, which is in the Program Files directory, e.g.:
>
>    C:\Program Files\MyApp\
>
> It seems weird to me that I can so easily delete all the contents of 
> that folder, even all the nested subfolders that were in it, yet not 
> the folder itself.
>
> And yes, I've checked: the folder is indeed empty.
>
> Even weirder, I can open LC afterward and run this in the Message Box:
>
>     delete folder "C:/Program Files/MyApp/"
>
> ...and it deletes as expected without complaint.
>
> My first hunch was that since the original uninstaller app is 
> launching the one doing the deleting, maybe I could add another layer 
> of misdirection by having a copy of that app make another app in temp 
> just to delete the damn folder.  No go, same error 32.
>
> Any of you come across something like this before?  How did you get 
> around it?


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list