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 Studio Chat / OpenRawFolder() throws an error when using GetDocumentsPath() as parameter - but only with SetErrorMode(2)

Author
Message
PSY
Valued Member
3
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 5th Oct 2019 01:02
Hi,

this code is a very basic directory crawler. It worked some time ago, now it doesn't, neither with AGKS nor AppGameKit Classic.
It throws the following error:
Error: Failed to find files in folder C:\Users\PSY\Documents/My Music", the app may not have permission to access it in main.agc at line xx

line xx is the following line: folderID = OpenRawFolder ( path )

There is no folder 'My Music' in my Documents directory.
The code works with SetErrorMode(1) and SetErrorMode(0), but not with SetErrorMode(2)!
It DOES work with SetErrorMode(2) on directories other than GetDocumentsPath(), though...






PSY


PSY LABS Games
Coders don't die, they just gosub without return
blink0k
AGK Developer
7
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Oct 2019 03:13
Same here. Very weird
adambiser
AGK Developer
4
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 5th Oct 2019 06:14 Edited at: 5th Oct 2019 06:26
If you debug, you still see the errors. (Wish it was possible to copy a single line from the debug log in Studio...)
These fail:
Log:C:\Users\Adam\Documents/My Music
Log:C:\Users\Adam\Documents/My Pictures
Log:C:\Users\Adam\Documents/My Videos
This happens in Classic, too.

Open a command prompt and type:
cd "%USERPROFILE%\Documents\My Music"
The folder exists.
Try going to that location in Explorer. Access is denied.

Error message when you try to access the My Documents, My Music, My Pictures, and My Videos folders in Windows Vista: "Access is Denied"
Bored of the Rings
15
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 5th Oct 2019 08:00
You've used both forward and back slashes.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
PSY
Valued Member
3
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 5th Oct 2019 11:54
Quote: "If you debug, you still see the errors"
I don't know why, but I failed to come up with that idea
Thank you for the link!

Quote: "You've used both forward and back slashes."

That shouldn't be a problem, as you are allowed to use both on modern Windows OS. Generally, / is used on Unix and Unix-like systems, and \ on Windows systems.
Back in the times before Windows, there was DOS and Unix. Unix already used /
The ancient DOS however didn't have directories. When they were introduced with MSDOS 2.0, IBM and MS were already using / for command switches, so they have been using \ for filepaths since then.

Nevertheless, I'm pretty sure the code worked properly some time ago on my Windows 10. Is it possible that changes were made to the commands? Or did MS deliver a patch which may cause that behaviour?


PSY


PSY LABS Games
Coders don't die, they just gosub without return
Bored of the Rings
15
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 5th Oct 2019 12:00 Edited at: 5th Oct 2019 12:02
agreed, shouldn't normally be a problem, but with AppGameKit you never know.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
adambiser
AGK Developer
4
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 5th Oct 2019 16:47 Edited at: 5th Oct 2019 16:52
Do you have the Steam version of Classic? If so, you can try going back to an older version to test.
Those folders are considered system-protected folders and I don't think that has changed recently. You can see them in Explorer if you uncheck "Hide protected system files" in Tools->Folder Options > View tab.

EDIT: I think this can be solved if the GetRawFolderNumFolders function is changed to not include hidden folders. (Perhaps GetRawFolderNumFiles as well). We have no way of toggling whether we want hidden files/folders or not and AppGameKit is just including them, which causes the error here.
PSY
Valued Member
3
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 5th Oct 2019 21:15
Yes, I have the Steam version of Classic.
I installed the depots of an early 2019 version and v2018.10.10
Both produce the same error

I just can't figure out why I used SetErrorMode ( 2 ). I wouldn't have done that if the code didn't run.
Maybe I tested it on Windows 7. Or I just forgot about that error Oo


Thanks alot for helping out


PSY LABS Games
Coders don't die, they just gosub without return
blink0k
AGK Developer
7
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Oct 2019 23:33 Edited at: 5th Oct 2019 23:34
So there appears to be a number of folders that are hidden from everything except the command prompt and AGK.
Even if i check "Hidden items" in the file explorer it doesn't show them.

So if you start a command prompt and then
rmdir "%USERPROFILE%\Documents\My Music"

Then run the app again it crashes on "My Pictures", so i imagine there are a few hidden folders there.

If you SetErrorMode(0) it will ignore the error
PSY
Valued Member
3
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 5th Oct 2019 23:56 Edited at: 5th Oct 2019 23:57
Quote: "So there appears to be a number of folders that are hidden from everything except the command prompt and AGK."

Yes, adambiser linked the Microsoft document --> https://support.microsoft.com/en-us/help/930128/error-message-when-you-try-to-access-the-my-documents-my-music-my-pict

Quote: "Even if i check "Hidden items" in the file explorer it doesn't show them."

These are not just hidden regular files, but hidden protected operating system files. As Adam mentioned, you can make the file explorer show them. See attached picture.

Be careful with these folders and files, tempering is not recommended


PSY LABS Games
Coders don't die, they just gosub without return

Attachments

Login to view attachments

Login to post a reply

Server time is: 2020-04-05 21:28:32
Your offset time is: 2020-04-05 21:28:32