Reading/Writing files anywhere on the system?

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
Draco_2k
Prole
Posts: 6
Joined: Thu Feb 09, 2012 8:22 am

Reading/Writing files anywhere on the system?

Post by Draco_2k »

tl;dr: love.filesystem makes it very clear it won't work on anything outside of userapp and .love directories, but is there any way to work with the filesystem at large? Custom modules or libraries?

Quick "Yes or No" question, I assume.

I'm looking into using Love for a not entirely game-related project - more or less a document editor - that'll need a working file browser and read/write for text, image and sound files from anywhere on the system. Is this possible? Are there any tricks, hacks, custom libraries, core Lua functions or anything else that would enable this?

Thanks!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Reading/Writing files anywhere on the system?

Post by Robin »

The short answer is yes.

The long answer is yes, but people will hate you.

Anyway, I don't think LÖVE will be of much use for the application you describe. Have you tried something like wxLua, for example?
Help us help you: attach a .love.
User avatar
Draco_2k
Prole
Posts: 6
Joined: Thu Feb 09, 2012 8:22 am

Re: Reading/Writing files anywhere on the system?

Post by Draco_2k »

That's a start, thanks!

I assume there's a hack around the limitations then? If there's anything better suited for this kind of stuff, that'd be great to hear too.

I only barely qualify as a script kiddie - but sometimes if you want to have something done, you have to do it yourself - so I'm looking for an engine that wouldn't make me write basic functions from the ground-up. Love is the best I've seen in that regard so far. I did try figuring out wxLua and official Lua libraries, but they're just way over my head.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Reading/Writing files anywhere on the system?

Post by Robin »

The Lua documentation has information about file I/O: http://www.lua.org/manual/5.1/manual.html#5.7
Help us help you: attach a .love.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Reading/Writing files anywhere on the system?

Post by nevon »

I would not recommend using Löve for general application development. The lack of a proper GUI toolkit alone will make you tear your hair out, and it won't behave like a native application.

There are so many better options. Here are just a few: Python+GTK, PyQt, QtLua.
User avatar
Draco_2k
Prole
Posts: 6
Joined: Thu Feb 09, 2012 8:22 am

Re: Reading/Writing files anywhere on the system?

Post by Draco_2k »

Robin wrote:The Lua documentation has information about file I/O: http://www.lua.org/manual/5.1/manual.html#5.7
Yep, I've tried it, but since it always returned nil I instantly assumed it didn't work (rather than blame my own incompetence). Does it really work?

EDIT: Yep, it works! Thanks! Now I just need to figure out how to get out of /user directory and do something actually useful.
nevon wrote:I would not recommend using Löve for general application development. The lack of a proper GUI toolkit alone will make you tear your hair out, and it won't behave like a native application.
Probably. But pretty much all lower-level languages are a closed road for me due to lack any experience whatsoever. At least Love allows you to do things like drawing images right away, and I don't need much more than organizing text and grouping some buttons.

QtLua looks like a possibility, so thanks a lot for that.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Reading/Writing files anywhere on the system?

Post by Robin »

Draco_2k wrote:Probably. But pretty much all lower-level languages are a closed road for me due to lack any experience whatsoever.
Both Lua and Python are very high level.
Draco_2k wrote:At least Love allows you to do things like drawing images right away, and I don't need much more than organizing text and grouping some buttons.
Trust me, using an actual GUI API (like the ones nevon and I linked to) is much easier than using LÖVE to make simple GUIs.
Help us help you: attach a .love.
User avatar
Draco_2k
Prole
Posts: 6
Joined: Thu Feb 09, 2012 8:22 am

Re: Reading/Writing files anywhere on the system?

Post by Draco_2k »

Robin wrote:Trust me, using an actual GUI API (like the ones nevon and I linked to) is much easier than using LÖVE to make simple GUIs.
Yeah, I know. I'm just trying to figure out a way around my own ignorance: "love.graphics.draw(image, x, y)" is quite a bit better than trying to figure out what the hell is Python or what do the ten billion lines of wxWidget templates mean.

Since the I/O module works fine, it's a start.
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: Reading/Writing files anywhere on the system?

Post by Ellohir »

With Java and Swing it's just click and drag to make a simple program GUI. Literally, it's ridiculously simple. I did some thing for Uni on Eclipse and was real easy :awesome: Just sayin' < /offtopic>
User avatar
Draco_2k
Prole
Posts: 6
Joined: Thu Feb 09, 2012 8:22 am

Re: Reading/Writing files anywhere on the system?

Post by Draco_2k »

Yeah, that works pretty well. Problem being there's not really going to be any native GUI for what I have planned: it's less a bunch of menus and more spawned boxes you drag around and link together in a hierarchy.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 7 guests