--- In [email protected], "entropyreduction" <alancampbelllists+ya...@...> wrote: > > ; ------------------------------------------- > local uFolder = unicode.new(?#C:\#) > unicode.file_watchfolder(uFolder, "Win.Debug(,)") > > messagebox("Ok Topmost", ?"Add, change or delete a file at root level in > C:\", "unicode.file_watchfolder test") > ; ------------------------------------------- > > > If I close the messagebox before adding or deleting a file in c:\, > > both arg(1)and arg(2) are identical. > > I think so, because uFolder is local. It goes out of scope > as soon as above block of code exits. The handle contained in > it is in invalidated. It then gets reused to point to a unicode file > name, so you get an old invalid handle, and same handle pointing to filename. > > > Solution is to use a static to hold handle in uFolder. > > Clear? > > I'll add comment to docs. > > I also notice I've implemented file_endwatchfolder(han), but forgot to > document it. >
Thanks for explain. It's clear now. For scripting practice, if possible, I prefer to release the handles when I no longer need them as mentioned in the XXXPluginReadme.rtf. it would also work fine for me without generating orphaned handles: ; ---------------------- unicode.file_watchfolder(unicode.new(?#C:\#), "Win.Debug(,)") ; ---------------------- Thanks.
