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.

DarkBASIC Discussion / interesting delete directory glitch

Author
Message
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Jul 2008 11:32
Has anyone else had the problem that when you use the delete directory glitch, it will delete the directory, but the file will still remain their (unaccessable, but still there) until the program (if it is an exe) or dbc is closed? I can't figure it out!

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
NanoGamez guy
18
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 24th Jul 2008 13:17
I came accross that error when I was working on my challenge entry, no matter what I tried, it just didn't work. I can't really see a solution, because DBC only has delete directory and delete file (which doesn't work on folders).

The only thing that might work is if you can find a dll that will do it, which you couldn't use in the challenge as dlls are not allowed (this is about your challenge entry, right?)


Time to change my sig...
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Jul 2008 16:30
Quote: "but the file will still remain their"


How do you mean 'still there'?

Do you mean if you look with Windows Explorer or your DB program?

Can you post an example program showing what is happening?

TDK_Man

Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jul 2008 19:55
I know DOS won't delete a directory unless it's empty. You can either use a switch inline with the command or use deltree instead. I wonder if DBC is accessing simply the RD command?

See if this would work.



BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Jul 2008 23:08 Edited at: 25th Jul 2008 00:01
hmmmm it doesn't seem to let you pass a command to cmd.exe Is there a way to move a directory? if there is, it could be moved to C:$Recycle.Bin

[EDIT]
Found a work-around. Since the file does disappear when the program closes, I thought "Why not just delete it and not show it again." So, what I did was renamed the folder to its name+"-%^&" (4 characters that will probably never be together) and if the file has those last 4 characters, it doesn't display the folder.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Jul 2008 03:03
Quote: "Since the file does disappear when the program closes"


So it's your function that isn't updating its list or view?


Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Jul 2008 04:09
It's likely, as Phaelax suggested, that you cannot remove a directory until it is empty of all files. I would guess that DBC is calling the function RemoveDirectory from the win32 API which specifically requires the directory to be empty. It forces you to manage your cleanup manually (hopefully reducing instances of "Whoop, I just deleted everything!"). So as a rule of thumb, try:

1. Make sure any files you wish to delete are closed
2. Delete all the files in the directory first
3. If there are subdirectories you'll have to open them, delete the files and delete them as well.
3b . and .. should remain
4. Make sure the Folder to be deleted is empty and closed
5. Delete the directory


As DBC was designed for game making, the file commands are available with the thought that you would be managing games files and directories (which would be relatively smaller and easier to manage than the user's entire volume set).

A variation of of the DOS code that might work is


Maybe everyone should keep deleteing files and folders out of the DBC challenges when all of the volumes on a computer are being accessed.

Enjoy your day.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Jul 2008 08:11
Quote: "Maybe everyone should keep deleteing files and folders out of the DBC challenges when all of the volumes on a computer are being accessed. "


I agree.

For the rest of your suggestions, it was a folder I made that was completely empty and closed.

Quote: "So it's your function that isn't updating its list or view?"


No, the actual file remains even after the delete directory command. Even in explorer, as long as dbc is still running, the folder is there. Once you exit dbc it disappears. If you have compiled the program into an exe, the folder disappears when the program closes.

I have attached a dba file of my challenge entry. Make a new folder by right clicking and selecting new, then delete it by right clicking it and choosing delete. then, close the program, but not dbc. Minimize dbc and go find the file. Unless this is a vista glitch (entirely possible) you will see that the folder is there, but can't be opened or deleted. As soon as you close dbc, it will vanish immediately.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?

Attachments

Login to view attachments

Login to post a reply

Server time is: 2025-06-07 06:50:20
Your offset time is: 2025-06-07 06:50:20