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.

AppGameKit Classic Chat / OpenRawFolder( dir$ ) Throwing an error if folder does not exist

Author
Message
PartTimeCoder
AGK Tool Maker
9
Years of Service
Recently Online
Joined: 9th Mar 2015
Location: London UK
Posted: 7th Jun 2017 04:59
Ok I know its supposed to throw an error but I'm finding this cumbersome when trying to recurse drives and get the folders, when it encounters a drive with no folders like a empty ROM drive it throws an error, Could a GetRawFolderExists(dir$) function be added or make OpenRawFolder(dir$) return a not found value instead of throwing an error

for example, to recurse drives and folders I would expect to be able to use the following:


but it errors out on my D: drive because it can not find any folders
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Jun 2017 08:03
please can you try
0 to drive_count-1
0 to folders-1
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PartTimeCoder
AGK Tool Maker
9
Years of Service
Recently Online
Joined: 9th Mar 2015
Location: London UK
Posted: 7th Jun 2017 09:11
you are right I should -1 those values but still makes no difference because the loop does not make it that far, it errors out on 2nd pass (index=1) which is my D drive a DVDRom with no disk present, if I insert a disk there is no error, we need to be able to check the result of OpenRawFolder() in code or have some way to detect the drivetype and/or presence of data.

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Jun 2017 12:05
i guess you have this line in code?
SetErrorMode(2)
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PartTimeCoder
AGK Tool Maker
9
Years of Service
Recently Online
Joined: 9th Mar 2015
Location: London UK
Posted: 8th Jun 2017 17:17
makes no difference what error mode I set, with 0 or 1 I get a windows explorer warning "There is no disk in drive" (as I would expect trying to access a rom drive with no media) with error mode 2 I now seem to be getting the explorer warning and the agk error.

anyhow, I found a work-a-round to get the windows drive and index only folders on that drive, the raw prefix depends on absolute paths which depend on knowing the drive letter, I wanted to build a full featured file browser but it is currently not possible.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Jun 2017 07:58
Quote: "makes no difference what error mode I set, with 0 or 1 I get a windows explorer warning "There is no disk in drive""

i not got this error with your example code.
what OS do you have?
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PartTimeCoder
AGK Tool Maker
9
Years of Service
Recently Online
Joined: 9th Mar 2015
Location: London UK
Posted: 9th Jun 2017 08:06
I have Windows 10, Do you have a CD/DVDRom drive connected?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Jun 2017 08:17 Edited at: 9th Jun 2017 08:35
me have win 10 pro with creators update and intern dvd-rw drive.

my test
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PartTimeCoder
AGK Tool Maker
9
Years of Service
Recently Online
Joined: 9th Mar 2015
Location: London UK
Posted: 9th Jun 2017 18:00
Your code produces the same result for me, works fine on C: (HDD) and F: (USB) but shows an error on Ddvd-rw) with no disk in drive
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Jun 2017 21:11
curious. maybe paul can explain.
u using the same agk version from steam?
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 9th Jun 2017 22:04
When using error mode 2 I get the permission error, but when I use error mode 1 I get no error, as expected, and no message from Windows explorer about putting a disk in the DVD drive (there is no disk in the drive). I'm using Windows 10 so it is strange that it would behave differently on different machines. Even so it sounds like the no disk error is coming from Windows rather than AppGameKit, so I don't think we can suppress that.
PartTimeCoder
AGK Tool Maker
9
Years of Service
Recently Online
Joined: 9th Mar 2015
Location: London UK
Posted: 9th Jun 2017 23:32
@Markus

I get same results on most recent version of AppGameKit on steam and my TGC account, I don't really use the steam version much as the folders in TGC version are more accessible (right click>>open file location)

@Paul

I only seem to get the windows warning for a short while after taking the disk out as again now its not showing when error mode is not 2, like windows ignores the drive if it has not been used in a while, this must be a Windows 10 thing because I expect to see the "No disk in drive" warning when attempting to access a ROM drive with no media present its been a bugbear of windows for years, a google of the warning retrieves over 40 million results, if I load up a disk and take it out and run the code again the warning shows again

in PureBasic I would avoid any windows warning by using the following


does it not make sense to be able to check for this result in code rather than relying on a error dialog, if you added GetDriveType() and GetDiskFreeSpaceEx() then we could check this ourselves, when we encounter a DRIVE_CDROM (5) we can check the size of the media and by doing so avoid any agk or Windows errors or warnings when attempting to call OpenRawFolder() on a empty drive letter

I can do this from a plugin easy enough as it only applies to windows anyway, just would be nice to have it all as part of native code, not only that, if a user published a game to disk these functions would help with media retrieval when loading game data from disk, I know that's all a bit 1990's but you never know

Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 20th Jun 2017 15:28
I tried this and have also no permission. Is this the wrong way, to get a folder-tree?



Maybe I can try it in to loops, and not recursive How is the right way, to get a folder-structure from a specific "Main-Path". Only a branch with all its childs.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 21st Jun 2017 14:18 Edited at: 22nd Jun 2017 09:13
Non-Recursive Path-Tree, without blocking

Without Type (so the code is not implement friendly yet)



And with using Types



Maybe it helps.

Login to post a reply

Server time is: 2024-04-26 11:40:08
Your offset time is: 2024-04-26 11:40:08