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 / How to ... folder tree from media-folder?

Author
Message
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 20th Apr 2017 17:21 Edited at: 20th Apr 2017 17:44
Hello AGKlers,

My idea was, that the user can copy some of its users own pictures into the media folder and I can search them and open them and show the user a tree-structure.

I have a problem, and it is very frustrating. I want to get the files I have in the media folder. My idea was, to "search" for them.
BUT! To use GetNextFolder I have to use SetFolder, but SetFolder creates a Folder in "AppData\Local\AGKApps\my program name" ... that is not, what I want!!! I want to read, not to write.

I am Using Windows 10 64 Bit.

I think, that there is a strange mixing between the Write-Folder and the Media-Folder from the program. I also don't understand, how I can change BACK! a folder. Because if I used once SetFolder (), I can't use SetFolder("") to navigate to my program App-Data-folder "root" again.




It is not Android, it is Windows! My work arround was, to create a file-list of all my files with PureBasic, but that can't be the right way.

Why do I use "." and ".." because I thought, that there are the problem, because in my tests I got "media" and other folder names I did not entered before.
I realizied, that SetFolder will create them, no matter if I wanted them or not.

This would create another problem, if I had to copy all data from my program into the user folder, that would not be very user friendly. If the user has Steam installed on another drive than the users, I had to copy nearly the complete program.
How can I get a folder-tree of my assets in the media folder?

Or do I have to do it with another program like I did it before? If it is not possible, my question then would be, how do I get a file/folder-tree of all assets from the users-folder?
(I wanted to create a tool also for AppGameKit users, but if I can't get some file information from unknown files, it is impossible to do it in a userfriendly way)


Thanks for help.
programming is ace
User Banned
Posted: 20th Apr 2017 18:12
I have had a peruse through the AppGameKit Challenge thread and these awesome guys have created some marvellous stuff - including a file/folder selector - which I think is what your looking for

this challenge think starts on Page 7 of it

https://forum.thegamecreators.com/thread/218129?page=7


Hope this helps
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 20th Apr 2017 18:34 Edited at: 20th Apr 2017 18:40
@programming is ace, thanks a lot. I think, that is, what I was looking for a long time now

But from what I read, with the Media-Folder there are some problems. I don't know, if I am doing something wrong, or there is still something like a "bug".
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 20th Apr 2017 20:22
I'm about to try something similar. Not heard of any bugs regarding the media folder though. The only issues I have had is saving files. Any file I save is in the Steam AppGameKit directory, which is okay in general, but not so much when you want to load and save things easily to the same folder. Not good for customisation either. I'd be interested if anyone knows a way to save and load from the same directory in AppGameKit?

Q6600. Nvidia 260GTX. 8 Gig Ram.
programming is ace
User Banned
Posted: 20th Apr 2017 21:47
From what I have gathered.

// Need to to do this first ---- BUG!!!
SetFolder("")

// Then can make the write patths accordingly, make sure paths assignments are correct for the O/S's
SetRawWritePath(selectedFolder)


I might be wrong - but it seemed work for those challenges
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Apr 2017 23:30
Yes that was our consensus, a weird bug. It showed us all about the lack of support for file browsing in AGK.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 21st Apr 2017 13:04
@Phaelax,

I tried it first in august 2016, no it is nearly may 2017. I can access the media-folder, but only once, after that, I can't change the folder. So I can't look in a bunch of folders if there are some needed assets or new assets. Maybe for costum music, or a nice 3D file viewer.

My workarround was, to create a list of files I have in the media folder with another programming language (PureBasic), open this file-list and open after that every file I wanted. And saved the files in AppData ... but with that in mind, I can't move files, create new files ZIP/UnZip how I want it, because I had to create everytime an Update of my file list. And my program itself has no idea, if the files changed since last time. But if I have to do all the things with files before in another language, I have a lot of more work and can't really justify why I don't use the other language for all things.

I want to compare files, open images and make from a bunch of images maybe one. I want to proof, if they are transparent or not, a lot of batch work. My idea was, to write the complete tool in AGK2 Tier 1 Basic. To learn the commands and so on. But I am struggleing opening a file. So the restrictions are like with GameMaker in this case. But in GameMaker I can search for unknown files in the game app folder itself

So what is the answer or "workaround"?

What can I do and what not? I have also sometimes a problem with "first look in the AppData after that in the Media-Folder". Changing assets in the media folder, starting program again, ... oh no, there was the same name in the user folder. Drives me crazy sometimes.

Can I make tools with AGK2? Do I have to use the Users-Picture-Folder? What can I expect with using ZIP-files? Can I use parameters like: "MyApp.exe Image.jpg" and it would open the image file? I think that would be specific for Windows only.

I understand, that not everything would work perfect in HTML5 or on iOS. But on one hand we will get DLL support and on the other hand, it is very complecated to open files from the programs own media folder?

Does my App not have the right, to read the folder structure in its own program folder?
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2017 13:09 Edited at: 21st Apr 2017 13:12
Quote: "Does my App not have the right, to read the folder structure in its own program folder?"

AGK has terrible file handling. It's not your app, it's a limitation in AppGameKit which we've tried many times to have fixed.

Also, once you've read a folder, you need to SetFolder( "" ) to return to the root folder, before you can go back down the tree. (I think)
(I.E. Once you've read "/media/assets/images/small/", you have to SetFolder( "" ) to return to "/", then navigate to "/media/assets/images/" Plus AppGameKit will always add a /media folder to the end of the folder path to further annoy you.)
Signature removed by mod because it's larger than 600x120... please resize and try again.
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 21st Apr 2017 13:28
@Mobiius

If I am using SetFolder("") once, I can't use any SetFolder() later.



If I use SetFolder("") before GetFolderStruct(myPath) my ListA-Array is empty, if I does not use it, I can have it work the first time. But I can't use the folders from ListA-Array and put them into GetFolderStruct(myPath) because the second time I would use SetFolder(..) with any folder, the command does nothing, I think.
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 21st Apr 2017 13:33
I don't get it.

If I write: SetFolder("") and try to use LoadImage("image.jpg") from my media folder, the image can't be found

I thought SetFolder("") is the media-folder from my program.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2017 13:52
Quote: "I thought SetFolder("") is the media-folder from my program."

Nope, it's the root folder. You'll need to call setfolder twice. SetFolder("") to return to the root, then SetFolder("media") to get you to media.
Signature removed by mod because it's larger than 600x120... please resize and try again.
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 21st Apr 2017 14:11
So this code shows me the file I put in the "Program.exe/Media/"-folder, but it did not shows me the folders (when I use GetFolder, GetFirstFolder, GetNextFolder ...)
It shows me the User-AppData "Program-Name/Media/"-folder




If it is possible, can you give me an example, how I have to use SetFolder() the right way, to get the folders in the programs-media-folder? Maybe also the SetRaw-Read-Folder or GetRawAppFolder(), I don't know.
I used that example, but I can't get any benefit from it https://www.appgamekit.com/documentation/Reference/File/GetFolder.htm

Thanks a lot for help.
Ranietz
AGK Gold Backer
19
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 21st Apr 2017 18:04
GetFirstFile() and GetNextFile() returns all the files from both the read folder and the write folder. I don't think there is a way to separate those two.
Keep in mind that the read folder = GetReadPath() + GetFolder() and the write folder = GetWritePath() + GetFolder().

To read from the programs media folder you could try SetRawWritePath( GetReadPath() )
Now the read path and the write path is the same.
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 22nd Apr 2017 09:07
@Ranietz, thanks for the command GetReadPath(), maybe I can figure out, how to use it in the right way
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 23rd Apr 2017 00:08
Perhaps this helps?
https://forum.thegamecreators.com/thread/219478
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Apr 2017 00:44
Fantastic Madbit! I am looking for something like that.
I think they need something for android/ios though
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Apr 2017 14:40 Edited at: 23rd Apr 2017 14:43
@MadBit,

I was thinking about writing also some plugin for that problem, but I don't know, if the plugin-thing is a good thing. I really needed that, but will we get any support from the AGK-team and the AppGameKit Tier 1 Basic anymore, if we write all core-commands with plugIns for ourself Windows only? I mean, will it help to evolve the use or will end in feeling more inconsistent in the longrun?

@MadBit, Thanks for the plugIn. To bad, that these core commands need a plugIn.

Login to post a reply

Server time is: 2024-04-16 05:52:26
Your offset time is: 2024-04-16 05:52:26