I put these lines anywhere (for instance, in love.load() ):
local success = love.filesystem.createDirectory( "qwe" )
print ("CREATED? " .. ( success and "yes" or "no") )
And I always get "no".
Is there any parameter I'm missing?
Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 126
- Joined: Sat May 09, 2015 9:15 pm
Re: Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
Just a guess (because I'm not sure what happens if you try to create a directory when it already exists) but have you looked in the defined save directory (check conf.lua) to see if the directory does exist now?
Definitely works.
Code: Select all
if love.filesystem.getInfo("skins", "directory") == nil then love.filesystem.createDirectory("skins") end
Re: Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
Oh, I didn't know it would try to create it on the directory set by love.filesystem.setIdentity. I want to create it on the main.lua path.
However, love.filesystem.getInfo does check if the directory exists on the main.lua path. Not sure if it makes sense.
However, love.filesystem.getInfo does check if the directory exists on the main.lua path. Not sure if it makes sense.
Re: Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
LÖVE, by itself, won't ever try to write in the game archive (even when it's a folder and not an archive), but it will read from both there and the save directory, with the latter coming first. You can only write stuff to the save directory, and that includes creating directories.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
Thanks for the info
However, I can't seem to make it work either. I added this line to my conf.lua:
t.identity = love.filesystem.getAppdataDirectory( ) .. "/myproject"
Then on love.load I have this:
I get no success for both directories. Can't create the "myproject" directory, neither the "Data" directory inside "myproject".
Also, this line on main.lua:
print (love.filesystem.getSaveDirectory())
Prints this:
C:/Users/luis/AppData/Roaming/LOVE/C:/Users/luis/AppData/Roaming/myproject
While this line:
print (love.filesystem.getIdentity( )) -- <. to see the path is right
Prints this:
C:/Users/luis/AppData/Roaming/myproject
So may I assume that any LÖVE project save directory is always under "C:/Users/luis/AppData/Roaming/LOVE/". Didn't see that in the documentation.
However, I can't seem to make it work either. I added this line to my conf.lua:
t.identity = love.filesystem.getAppdataDirectory( ) .. "/myproject"
Then on love.load I have this:
Code: Select all
print (love.filesystem.getIdentity( )) -- <. to see the path is right
local dataDir = love.filesystem.getInfo( love.filesystem.getIdentity( ) )
if (dataDir == nil) then
local success = love.filesystem.createDirectory( love.filesystem.getIdentity( ) )
Common:PrintDebug ("Directory doesn't exist and was created: " .. ( success and "yes" or "no") )
end
local dataDir = love.filesystem.getInfo( "Data" )
if (dataDir == nil) then
local success = love.filesystem.createDirectory( "Data" )
Common:PrintDebug ("Data directory doesn't exist and was created: " .. ( success and "yes" or "no") )
end
Also, this line on main.lua:
print (love.filesystem.getSaveDirectory())
Prints this:
C:/Users/luis/AppData/Roaming/LOVE/C:/Users/luis/AppData/Roaming/myproject
While this line:
print (love.filesystem.getIdentity( )) -- <. to see the path is right
Prints this:
C:/Users/luis/AppData/Roaming/myproject
So may I assume that any LÖVE project save directory is always under "C:/Users/luis/AppData/Roaming/LOVE/". Didn't see that in the documentation.
Last edited by molul on Thu Jun 14, 2018 6:17 am, edited 1 time in total.
- zorg
- Party member
- Posts: 3436
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
You need to set t.identity to a singular string, which will be the relative path starting from löve's basic save directory; it won't take absolute paths.
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.
Re: Löve 11.1: love.filesystem.createDirectory( ) doesn't seem to work
Oh sorry, I edited my post above before reading your reply. I understand now. Thanks!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests