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 / "Perform Checklist" Reports A:\ Drive When There Is None

Author
Message
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 7th Feb 2012 18:03
I did run a forum search and found nothing relating to this. I'm pretty sure someone should've noticed it and posted about it by now if it was DBPro...surely...

Anyway, take a looksie, run the code, tell me if anybody gets the same problem:


I know the obvious answer would be "FOR i = 2 TO...etc" but this is the wrong solution as the application has to run on Other People's Computers which may not get this error (or who may have an A drive).

Solution: Check path validity (*see below) so this ain't a major train smash. I'm posting more for the sake of anybody else with this error and because I'd like to know if I'm the only one getting it.

*Fixed code:


Oh yeah, my specs:


So, anyone else got this "ghost [drive a] in their machine"? Am curious about what causes it. I picked my brain a while and couldn't come up with a thing. Theories welcome too.

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Feb 2012 21:30 Edited at: 7th Feb 2012 21:32
I get
a:\
c:\
d:\
And only c: and d: exist.

Using DBPro free on my work PC...
Dell Optiplex GX745, Intel Core 2 Duo
E8400 @ 3.00GHz
1.96GB RAM
Xp Pro w. SP 3
And looking at the specs of this PC makes me miss my laptop...almost time to go home.

In the version with path exist() it only shows C: drive present, hence that a CD drive doesn't exist (because there is not path). So if you're worried about detecting a CD drive then maybe the path exits() command isn't what you want. Me - doubt I'll ever care if a CD drive exists.
Does the path exist() version report unmounted virtual drives?

Oh and I'm guessing that the a: is reserved by the BIOS back in the days where we used to have floppies... amazing they never renamed drives. B through Z are all optional drives.

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 8th Feb 2012 09:30
Quote: "...So if you're worried about detecting a CD drive then maybe the path exits() command isn't what you want...Does the path exist() version report unmounted virtual drives?"

So long as there's a CD in the drive, the path is valid on my machine. The same applies to unmounted virtual drives: no image = no cd in drive = not valid path. This is actually perfectly what I want as I'm building my own file-browser function (Using the winAPI for this in DBPro is actually such a hassle because you gotta create a data structure which is umpteen lines of code more than it should be in languages designed for structs so you may as well spend them on making a custom window that looks awesome[r than Windows's windows] ). Basically I don't want users to have the option of clicking a drive that's empty coz there's nothing there for them to click. It also saves me a dialogue saying "Drive's empty, Dawg!". I should block restricted folders from appearing too, heh.

Quote: "Oh and I'm guessing that the a: is reserved by the BIOS back in the days where we used to have floppies... amazing they never renamed drives. B through Z are all optional drives."

Actually that makes sense. I think you're onto something there. I'm gonna look into this and see what I come up with perhaps there might be a fix so far as DBPro's source goes so that the next compiler ver won't do this.

On a side note:
I thought about my previous fix to and actually came up with a slightly better and faster method for detecting drives.

It just seemed pointless to call PERFORM CHECKLIST FOR DRIVES and PATH EXIST() at the same time.

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 8th Feb 2012 17:35
Looks like you've got a good solution there.
I think I'd go a step further (not necessarily for a file browser program though - which I agree should only show valid paths - the error message is slow and annoying in Win):

If I were looking at verifying all available drives I'd go with PERFORM CHECKLIST FOR DRIVES and then check if Path Exists() for a:\ and b:\ then just list the others as normal, maybe add in an option that says "no volume mounted / present" for empty CD drives and unmounted virtual drives.

My concern (albeit a small one) is that if you are looking at drives by letter, you are fixed to that method. So if some day in the future Windows allows you to use the volume's name instead of drive letter (or something to that affect) then checking by character might not work. But again that is a small concern and probably just paranoia. The method you're using will likely work and is much less code than what I propose.

I'd probably go with the combo method, because I think many users might be concerned "where'd my CD drive go?" and such. I know when it disappears randomly from the My Computer folder it always gives me slight pause. Would be awesome if Windows showed the drive and said "no volume loaded" and wouldn't let me even click on it. Again, personal preference.

Thanks for this thread. I've learned something useful here.

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 8th Feb 2012 18:10
Glad it was of use, thanks for your interest and inputs.

smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 11th Feb 2012 18:43
built my own file browser a while back as well looked just like windows skinnable for different os's as well. but u do know u can use the windows file browser in any darkbasic program right?

A child's dream never dies.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 12th Feb 2012 08:01
Quote: "...u do know u can use the windows file browser in any darkbasic..."

Yep, I do know. There are certain reasons why I built my browser function though. As a text-only and dynamic function I can create any look and feel with it; a typical Windows-style window, an atypical window, text on a scroll, etc. Can even run it over a movie while its playing (hardware permitting). This saves me rewriting it ever again (not to say I won't constantly try to improve it). Using the winAPI in DBPro is fine for calls that don't need complex data structures. Unfortunately all browser windows require structs that DBPro does not natively support and creating them using memblocks and pointers is a lot of work (Unless there's something I'm missing?). I weighed it up in the beginning and concluded that if I was going to expend energy on lines and lines of code, I may as well make something unique that was my own and could be tailored to any future use I may have for it.

Login to post a reply

Server time is: 2024-11-22 06:12:39
Your offset time is: 2024-11-22 06:12:39