Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Issue with tutorial in newsletter 106, delete directory command

Author
Message
erebusman
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 9th Jun 2012 05:20
Greetings !


So I was trying to utilize the tutorial in newsletter 106 here.

It works about 80% of the way but it will not remove the .wav files that are in my media folder nor the folder itself. It does remove the data folder and all the files in there. It also removes all of the .jpg and .png files in the media folder... leaving only .wav files.

So I was unsure what would be causing this .. so I threw the Close_Files: subroutine in my quit game subroutine as well as right after the read files but its still leaving the folder.

So I suspect something unique/special about the .wav files or them being locked or such is causing this... has anyone seen something like this or have some in sight?


Firstly my opening section of the program looks like this:




And here are the Open_Files and Close_Files subroutines.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Jun 2012 11:20
I would guess you need to somewhat flush the sound banks?

like load a null file into all the sound banks...

just a quick guess

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 11th Jun 2012 22:46
Don't know these DIRBLOCK functions too well but if I understand correctly, they create a folder-structure within the application's main directory and leave it up to the user to delete?

If I'm understanding correctly, it could be that the files or a file is still "in use" (or marked so by windows). Sometimes you close a file in an application, yet it is still "in use" and cannot be deleted until the application is terminated (or sends a message to tell windows the files is closed??). So, if you can't delete the file, you can't delete the directory.

Solution 1: Make sure to "DELETE SOUND" all your loaded sounds (from that directory). Then use the "WAIT" command to wait about a second (some processes may be "busy"). Then call your close file procedure.

Solution 2: Along the route of solution 1, however, use a codition:

This is a sorta brutish method and can be problematic as it'll keep looping until the file is deleted so you may wanna consider broadening it with a TIMER()-based error handling procedure; say, if it takes > 3 seconds, exit function with a return of 0, else return 1.

Solution 3: Write a batchfile to delete the files, then the directory and have it execute on program end, for example (It's been a while since I've scripted there may be mistakes in this as I can't test it right now):

Note, you can run a batch-file invisibly using VBScript (Don't ask me how, I don't remember as vbs isn't my language of choice).

Other than that, can't think of anything else. Perhaps use a different method of protecting your assets like a basic encryption. I mean so far as I can tell, with the DIRBLOCK method somebody can still copy them from disk while your app is running so encrypting/un-encrypting would be about the same but it would give you the advantage of being able to access only what you needed when you needed it instead of having to unpack the whole directory... Or am I missing the point of dirblocks? Anyway, hope this is of some help.

erebusman
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 12th Jun 2012 03:46
Thanks guys I'll run over those suggestions and see what I can come up with much appreciated.
erebusman
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 13th Jun 2012 06:45
So I was able to fix this by doing the following

1: Stop using the Enhanced Audio Plugin
2: Changed the loading of sound files to the following code



This was necessary because the method of using the Enhanced Audio plug in did not seem to work with MEMBLOCK creation. In the end everything works just as well with the original sound system and I never did end up using OGG files like I had thought about so there was no reason to stick with it anyways.

Once I used memblocks in the snippet provided all the cleanup works as expected now.

Thanks for the help guys.

Login to post a reply

Server time is: 2024-11-23 20:37:21
Your offset time is: 2024-11-23 20:37:21