local function LoadConfig()
local CONFIG_FILE = love.filesystem.getSaveDirectory().."/config.txt"
print("Attempting to load config")
print("File path: "..CONFIG_FILE)
local cfgfile = nil
if (love.filesystem.exists(CONFIG_FILE)) then
cfgfile = love.filesystem.newFile(CONFIG_FILE)
else
print("a")
if (love.filesystem.write(CONFIG_FILE, DefaultConfigString())) then
print("b")
cfgfile = love.filesystem.newFile(CONFIG_FILE)
else
print("c")
error("Can't read and/or create config.txt file.")
end
end
for k, v in pairs(cfgfile:lines()) do
print("Line "..k.." = "..v)
end
end
local function DefaultConfigString()
return [[m1 +primary
m2 +secondary
w +forward
a +left
d +right
s +back]]
end
Notice the part where it says print("a"). After that, it executes NEITHER print("b") or print("c"), the function just ended, so the only thing I can assume is that it just stops dead at love.filesystem.write, without giving a warning or error of any kind. I also noticed the CONFIG_FILE path name contained "C:/Users/.." instead of "C:/Gebruikers/..." (Dutch language pack, I'm on Windows 7 Enterprise) which my file system uses, although I don't know if that matters.
Doesn't work either. Also, I don't see the save directory being created in the AppData/Roaming/LOVE/ folder, like the path indicates. I did use the love.filesystem.setIdentity( "gamename" ) in love.load earlier.
Clavus wrote:I also noticed the CONFIG_FILE path name contained "C:/Users/.." instead of "C:/Gebruikers/..." (Dutch language pack, I'm on Windows 7 Enterprise) which my file system uses, although I don't know if that matters.
This may be the source of the problems. Does C:/Users/... exist on your system?
Clavus wrote:I also noticed the CONFIG_FILE path name contained "C:/Users/.." instead of "C:/Gebruikers/..." (Dutch language pack, I'm on Windows 7 Enterprise) which my file system uses, although I don't know if that matters.
This may be the source of the problems. Does C:/Users/... exist on your system?
Nope. And because this is so, it might be that love.filesystem.setIdentity isn't functioning either (thus the reason that there is no save folder).
The path is supposed to be extracted from your environment variables, try finding the one that points to C:\\Users and change it to C:\\Gebruikers. (though I must say I am horrified by them even thinking about localizing such paths, microsoft never ceases to amaze me)
bartbes wrote:The path is supposed to be extracted from your environment variables, try finding the one that points to C:\\Users and change it to C:\\Gebruikers. (though I must say I am horrified by them even thinking about localizing such paths, microsoft never ceases to amaze me)
On the other hand, if I type C:/Users/<myname>/AppData in the explorer bar, it does direct me to the right place. The translations might just be aliases. The problem is probably somewhere else.
Clavus wrote:I made sure that Love.exe is run as administrator, in case that might've caused why no save directory is being created, but alas.
That shouldn't be necessary. LÖVE feels very much at on Linux, where requiring for a program to "run as administrator" when not really needed is considered a deadly sin.