various file system questions

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
raingloom
Prole
Posts: 36
Joined: Wed Apr 22, 2015 12:35 am
Location: Always elsewhere

various file system questions

Post by raingloom »

First of all: love.graphics.newImage(path) can't seem to open anything outside the current directory. Am I doing something wrong? (so far only tested on Windows 7)
I need it to open any file for a vertex editor. (render an image as background, then the user can make a polygon over it. it sucks having to move the image file :E)

Second: for the previously mentioned project I made a library for handling various vertex functions (loading/saving, automatic UV, bounding box/quad, etc)
I moved it into a separate directory which I want to use for my libraries. I deleted the original in the vertex editor's directory and made a symlink to it. Now require"verts" fails, also I can't open the symlink in ZBStudio, but that's a different matter.
The file system is an external HDD formatted with NTFS and everything has rwx access. (Configured with Ntfs-tools)
Running Ubuntu 14.10 x64.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: various file system questions

Post by Robin »

love.filesystem is contained to the .love (or game directory) and the write directory.
Help us help you: attach a .love.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: various file system questions

Post by Nixola »

Love.filesystem as well as any LÖVE loading function
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: various file system questions

Post by s-ol »

If you gain access to the image in some other way you can create an ImageData from the data itself.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: various file system questions

Post by Nixola »

Yes, but the loading function themselves don't provide access to external folders
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: various file system questions

Post by s-ol »

Nixola wrote:Yes, but the loading function themselves don't provide access to external folders
Yeah, like I said there are other ways of opening files than love.filesystem. with those you can access other files.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
I~=Spam
Party member
Posts: 206
Joined: Fri Dec 14, 2012 11:59 pm

Re: various file system questions

Post by I~=Spam »

To open files elsewhere use the functions that are built into lua (they are harder to use though). Or you can just use this ;) viewtopic.php?f=5&t=9479
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
User avatar
raingloom
Prole
Posts: 36
Joined: Wed Apr 22, 2015 12:35 am
Location: Always elsewhere

Re: various file system questions

Post by raingloom »

I know Lua's io functions, so I assumed require would work.
I have tried passing a file handle to the newImage function, but of course it did not work. An ugly workaround could be making a local copy.

What I still don't get is why my symlink is not working?
User avatar
I~=Spam
Party member
Posts: 206
Joined: Fri Dec 14, 2012 11:59 pm

Re: various file system questions

Post by I~=Spam »

Use the link I gave you. It does ALL the work for you. It work perfectly!
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
User avatar
raingloom
Prole
Posts: 36
Joined: Wed Apr 22, 2015 12:35 am
Location: Always elsewhere

Re: various file system questions

Post by raingloom »

I've checked it, but for something as simple as loading my modules, I didn't want to include another module in each project. I think I'll use it for the editor's file loading though.
Of course no one thought of the most obvious solution:

package.path=package.path..";../Libs/?.lua"

...like seriously, I feel so stupid right now.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests