Filesystem Hack: Set Identity to Whatever You Want

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by BlackBulletIV »

Pretty awesome! (Apart from not being able to open files)
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by kalle2990 »

After some experimenting with this under Ubuntu, and realizing I forced the use of C: before, I have rewritten the opening of files to use gnome-open if it sees that the system isn't Windows. If you're computer doesn't support gnome or isn't linux, you can change the open_command value to something of your liking ;)

This also fixes a problem when the Windows install wasn't located at C:
Attachments
File Explorer.love
Version 1.1 - More platform independant
(1.21 KiB) Downloaded 84 times
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by BlackBulletIV »

That's better. The command for Mac is "open".
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by nevon »

Use the following instead. That'll open the directory, file or URL in whatever the preferred application is:

Code: Select all

xdg-open
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by kalle2990 »

nevon wrote:Use the following instead. That'll open the directory, file or URL in whatever the preferred application is:

Code: Select all

xdg-open
Does it work for both Linux and Mac?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by Robin »

kalle2990 wrote:
nevon wrote:

Code: Select all

xdg-open
Does it work for both Linux and Mac?
Don't think so, XDG is what is now freedesktop.org is. They work on interoperability for desktop environments using X. Mac doesn't use X, so it doesn't work with that. OS X does provide the similar command "open", though.
Help us help you: attach a .love.
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by kalle2990 »

Robin wrote:Don't think so, XDG is what is now freedesktop.org is. They work on interoperability for desktop environments using X. Mac doesn't use X, so it doesn't work with that. OS X does provide the similar command "open", though.
Yeah, I read that the Mac command is "open" somewhere, and now both you and BlackBulletIV told me ;) I'll see if I can use the saving directory value to find out if it's either of those, as I just saw they are different on the wiki.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by nevon »

kalle2990 wrote:
nevon wrote:Use the following instead. That'll open the directory, file or URL in whatever the preferred application is:

Code: Select all

xdg-open
Does it work for both Linux and Mac?
I should have been more specific. xdg-open would be a replacement for gnome-open. xdg-open will work in most Linux environments (and possibly BSD and what have you as well, but obviously Löve doesn't support those platforms).
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by thelinx »

Indeed. xdg-open is the preferred executable, since gnome-open will only work for users using gnome (obviously).

xdg-open is an executable that's provided by the current desktop environment of the user, provided it follows the Freedesktop.org standard.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Filesystem Hack: Set Identity to Whatever You Want

Post by BlackBulletIV »

kalle2990 wrote:I'll see if I can use the saving directory value to find out if it's either of those, as I just saw they are different on the wiki.
I think the only way to detect whether the operating system is Mac is by checking a few common root folders that are on a Mac (and not on Linux, unless someone's creating new root folders for some reason), like "/Users", "/System", "/Applications", and "/Library".

I did suggest a while ago something like a love.platform variable which would greatly aid this sort of thing, but I don't think that was very successful because it would really only be useful in these sort of applications.
Post Reply

Who is online

Users browsing this forum: No registered users and 47 guests