Gather files from another folder

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.
Post Reply
Char Jones
Prole
Posts: 1
Joined: Wed Oct 30, 2019 7:07 pm

Gather files from another folder

Post by Char Jones »

Hello, new around here and I just have one question.
I have the folder structure like this to keep my files organized:

root
+ src
* player.lua
+ assets
* img
- panda.png
+ main.lua

But I want to retrieve the 'panda.png' from player.lua like love.graphics.newImage('./../assets/img/panda.png') but tells me the file doesn't exists, there's a special way to do it?
Thanks in advance
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Gather files from another folder

Post by Jasoco »

I'm not completely sure how to read your folder structure. Use the Code tags to format it with spaces denoting folders so it's easier.

Code: Select all

main.lua
img/
  panda.png
src/
  player.lua
(Is that close to what you have it set up as?)

Anyway, is the image file not loading when you put the path in? It's relative. With the root folder where the main.lua file is being the top of the structure. So if that image is just in a folder called img at the root of the project then it would just be "img/panda.png". (Or if it's img inside assets then it's "/assets/img/panda.png") You don't need the ../ stuff.
Post Reply

Who is online

Users browsing this forum: Google [Bot], Imnotaplayer and 82 guests