Skip to main content
↑
↓
Spherical forums
Community for the
Sphere game engine
New?
Contact Us
to register an account!
1 Hour
1 Day
1 Week
1 Month
Forever
Community
Help
Search
Recent Posts
Log in
Contact Us
News
Spherical
Facebook
-
Twitter
-
Discord chat
New?
Contact us
to register an account!
Sphere Development
Sphere Support
Script Support
How to get to the Sphere root?
1
Print
Topic: How to get to the Sphere root?
(Read 6098 times)
previous topic
-
next topic
0 Members and 1 Guest are viewing this topic.
DaVince
Legendary Poster
Posts: 1,001
Logged
Administrator
Used Sphere for, like, half my life
How to get to the Sphere root?
June 22, 2013, 08:25:05 pm
I could have sworn that / would get you the root directory, but GetFileList() doesn't seem to like it (in both 1.5 and 1.6)... It'll just say this:
Code:
[Select]
Invalid path: '/'
Doing some tricks with ../../ etc. gives me the same issues. Anyone know how to get there? I'm trying to make a new startup game that loads icon.png files from game dirs, but I just can't seem to get to the files... I even looked at the old Sphere 1.1 startup game and it didn't help whatsoever.
Spherical Downloads Repo
||
My (really old) Sphere stuff
Radnen
Big Chungus
Posts: 1,440
Sphere Studio Developer
Logged
Senior Staff
Wise Warrior
Re: How to get to the Sphere root?
Reply #1
–
June 22, 2013, 08:33:44 pm
Try:
~/icon.png
or
../icon.png
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.
Sphere-sfml
here
Sphere Studio editor
here
DaVince
Legendary Poster
Posts: 1,001
Logged
Administrator
Used Sphere for, like, half my life
Re: How to get to the Sphere root?
Reply #2
–
June 22, 2013, 08:35:42 pm
That's only if you want the icon.png from the path of the game currently running, though. Once you try a path like /games/someothergame/icon.png, or ../../someothergame/icon.png... it just fails spectacularly. I remember some really old startup games using a png icon of some kind, but I can't find any of them...
Edit: after some experimenting, I found that GetFileList can escape out of its game directory. However, LoadImage
cannot
(when adding an extra ../ to escape out of the game's dir, Sphere aborts with an "invalid path" error). This is a problem.
Edit 2: oh no... OpenRawFile() is the same... I'm sure it used to not be like this - after all, the startup game in old versions of Sphere opened files in other game dirs entirely. What happened, here?
So in the end, I find out that I cannot make the kickass new startup game I planned to make, or at least, not with info.txt and icon.png reading support. Ah, well. Maybe it's time for a different kind of game launcher, anyway.
Last Edit
: June 22, 2013, 08:51:28 pm by DaVince
Spherical Downloads Repo
||
My (really old) Sphere stuff
Radnen
Big Chungus
Posts: 1,440
Sphere Studio Developer
Logged
Senior Staff
Wise Warrior
Re: How to get to the Sphere root?
Reply #3
–
June 23, 2013, 12:35:27 am
Have you tried rooting the path?
Code: (javascript)
[Select]
Math.sqrt("../");
I don't think you can access other peoples files. It was supposed to be a sandboxed engine.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.
Sphere-sfml
here
Sphere Studio editor
here
1
Print
Sphere Development
Sphere Support
Script Support
How to get to the Sphere root?