bartbes wrote:If you enable the console, do you see any output?
Nope. The function just ends while evaluating the love.filesystem.write(CONFIG_FILE, DefaultConfigString()) part. It prints "a", but neither "b" nor "c".
local function LoadConfig()
local CONFIG_FILE = "config.txt" -->we don't use absolute paths, it's a myth, a bad one.
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
cfgfile:open("r") --> DON'T FORGET THIS
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
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)
The localization is actually just a link to the true "c:\users" folder, if you navigate via cmd-line and use dir you will see your users- Directory, it's the same thing in vista.
Win7 does use a diffrent layout for the folder structue for "my music" etc but even that is linked onto the older structure of vista.
tl;dr version:
It's the same thing using the loclaized folder name or the english "true name" of the folder, because the localized is just a link to the hidden folder named in english.
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
cfgfile = love.filesystem.newFile(CONFIG_FILE)
cfgfile:open("w")
if (cfgfile:write(DefaultConfigString())) then
cfgfile:close()
cfgfile = love.filesystem.newFile(CONFIG_FILE)
else
error("Can't read and/or create config.txt file.")
end
end