## Is there a way of saving and loading files from anywhere?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
TESLA
Prole
Posts: 2
Joined: Sun May 05, 2019 7:34 am

### Re: Is there a way of saving and loading files from anywhere?

Hey guys I need help!
I'm trying to upload a png file with the name blocky.png. My love.exe file is in the C: drive and this is how I tried loading it.

Code: Select all

local heroman
heroman = love.graphics.newImage("C:\Users\Kazabite\Desktop\Engine\gfx\blocky.png")
end

where Kazabite is the user name, Engine is the file where main.lua is present and gfx where the png file is located.
However, I get an error that there is an invalid escape sequence near '"C;'

Can anyone help plz?

zorg
Party member
Posts: 2753
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

### Re: Is there a way of saving and loading files from anywhere?

And by default, that's not going to work, löve only supports relative paths from where your main.lua is, and the project's save directory; It does not support absolute paths like what you are trying. (hence why i linked you to this thread if absolute paths would be a necessity to you; clearly they aren't)

Do use the wiki, that's why it's there: https://love2d.org/wiki/love.filesystem

But, assuming that your main.lua is in the Engine folder, you'd do love.graphics.newImage("gfx\blocky.png") and that should work.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

pgimeno
Party member
Posts: 1944
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

### Re: Is there a way of saving and loading files from anywhere?

Besides what zorg said, use forward slashes and you won't get the invalid escape sequence error. Also, backslashes are not portable.

Darlex
Party member
Posts: 121
Joined: Sun Sep 24, 2017 10:02 am
Location: %_
Contact:

### Re: Is there a way of saving and loading files from anywhere?

ivan wrote:
Sun May 05, 2019 5:12 pm
Darlex wrote:
Sun May 05, 2019 4:47 pm
I want to give that sensation of comfort of saving and loading files from anywhere to anywhere.
Frankly speaking, I don't see anything "comfortable" in dealing with file dialogs, etc.
In fact, most modern programs never ask you to browse around the device's filesystem.
A good example would be apps on Android and iOS.
Im not thinking about creating a game editor for android or ios

Code: Select all

while true do me:procrastinate() end

### Who is online

Users browsing this forum: Google [Bot] and 4 guests