Get a file from anywhere in the filesystem.

Monkey Forums/Monkey Beginners/Get a file from anywhere in the filesystem.

consty(Posted 2016) [#1]
Is there a way to load a file from anywhere from the hard disk?
e.g. C:\Files\

Also this will be useful to happen at run time as well, because this is the only way to make that load dynamic content.


abakobo(Posted 2016) [#2]
Yes you can (on desktop targets)


Gerry Quinn(Posted 2016) [#3]
LoadString / SaveString is the standard because it's guaranteed on all targets. Every target has a different filing system and maybe security constraints, so you have to do the above on a target by target basis.


consty(Posted 2016) [#4]
In this particular case I will target only Desktop, since this will come handy for utilities (level editors and stuff).



I use Windows 8.

When I try to create the file in C:\ the file is created (returns 1), but it's not visible in CommandPrompt or WindowsExplorer.

This is because my user has not Write permissions on the C:\ drive. But then I go to zzz.buildv84f\glfw3\gcc_winnt\Debug\MonkeyGame.exe and I do right click and RunAsAdministrator and then it can write to C. This was a simple detail that bothered me, but anyway now it seems OK.


Nobuyuki(Posted 2016) [#5]
Use filesystem, filestream, databuffer or any of the brl io stuff. They all have different ways of loading files, so pick the one which is most appropriate for your data structure.


consty(Posted 2016) [#6]
Thanks, this is a good way to do so.