Create file in localization of app

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
GHPL
Prole
Posts: 7
Joined: Wed Jun 21, 2017 7:10 pm

Create file in localization of app

Post by GHPL »

love.filesystem.newFile(love.filesystem.getSource( ).."file.txt") that don't working :/
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Create file in localization of app

Post by raidho36 »

Just do love.filesystem.newFile("file.txt")
GHPL
Prole
Posts: 7
Joined: Wed Jun 21, 2017 7:10 pm

Re: Create file in localization of app

Post by GHPL »

raidho36 wrote: Wed Jul 19, 2017 5:07 pm Just do love.filesystem.newFile("file.txt")
That will create file in C:\Users\User\AppData\Roaming\LOVE\project name\file.txt
I want in place where is app.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Create file in localization of app

Post by raidho36 »

Well you can't. There's a solid number of very good reasons for that, trust me, it's better that way and saves you a ton of trouble on weird issues.
GHPL
Prole
Posts: 7
Joined: Wed Jun 21, 2017 7:10 pm

Re: Create file in localization of app

Post by GHPL »

Oh I can use lua functions ... http://lua-users.org/wiki/FileInputOutput
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Create file in localization of app

Post by ivan »

raidho36 is correct, you don't want to write in the install folder and depending on the user's permissions it might not work at all.
Also, please note that "localization" is something entirely different as opposed to "location". :)
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Create file in localization of app

Post by Nixola »

Lua functions won't work if you make a .love file. They may work but you probably won't easily know where the file ends up. They're not even guaranteed to work if you run the project as a folder.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
GHPL
Prole
Posts: 7
Joined: Wed Jun 21, 2017 7:10 pm

Re: Create file in localization of app

Post by GHPL »

So it's impossible to read info from .txt file in same folder where is app?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Create file in localization of app

Post by raidho36 »

App folder is read only, you can't write to it. If the project runs from fused file or compressed package, then the package is accessible instead of folder.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests