Page 1 of 1

Save directory different between fused and non-fused games [RESOLVED]

Posted: Sun Jul 01, 2018 10:21 am
by drunken_munki
In both cases I manually use setIdentity() to something simple such as 'DW', but both examples give different save folders on a Win7 system.

For the non-fused game the save path resolves to: "C:\Users\Me\AppData\Roaming\LOVE\DW" where the 'LOVE' folder was created automatically (all caps).

For a fused '.love' game to the 'love.exe', the save path resolves to: "C:\Users\Me\AppData\Roaming\DW" which is missing the 'LOVE' parent folder.

So please some help: 1) I'm thinking of just reading the path and manually correcting it but I'm hoping for a more elegant solution. 2) to understand why this is happening.

Edit:

So I've tried this as a trick, and it seems to work for me on windows. Does anyone see any possible issues with it?

Code: Select all

  love.filesystem.setIdentity("DW")
  if not string.find(love.filesystem.getSaveDirectory(), "LOVE") then
    love.filesystem.setIdentity("./LOVE/DW")
  end

Re: Save directory different between fused and non-fused games

Posted: Mon Jul 02, 2018 11:06 am
by zorg
The original logic behind why it works this way was probably something like when you're developing, it's not fused, so it should be under the LOVE folder, but when you release your project, it should be under its own folder in appdata (and elsewhere).

Re: Save directory different between fused and non-fused games

Posted: Mon Jul 02, 2018 11:47 am
by pgimeno
In Linux everything goes to ~/.local/share/love/ if not fused, so that wouldn't work for Linux. Also, I'd check if it creates the LOVE subdir when it does not exist before running the game to start with.

I've tried using this as main.lua:

Code: Select all

love.filesystem.setIdentity("./LOVE/DW")
print(love.filesystem.write('abc', 'def'))
and it does not create a LOVE or a DW subdirectory, much less a file called 'abc'. The output is:

Code: Select all

nil	Could not set write directory.
However, using love.filesystem.setIdentity("love/DW") works. If you use lower case, it will work also on Linux. To do the match without case sensitivity, you could try using [Ll][Oo][Vv][Ee] as the pattern.

And I suggest to report it to the developers.

Re: Save directory different between fused and non-fused games

Posted: Mon Jul 02, 2018 1:41 pm
by drunken_munki
Cheers for the advice everyone, this is pretty odd but the workarounds help a lot.
pgimeno wrote: Mon Jul 02, 2018 11:47 am However, using love.filesystem.setIdentity("love/DW") works.
OK I tried this and conform it still works, so I'll use this instead.

Re: Save directory different between fused and non-fused games

Posted: Mon Jul 02, 2018 6:59 pm
by ivan
Munki, it might be possible to use "love/dw" when running in fused mode but not vice versa.
There is no point in supporting both fused and non-fused modes -
you already have control of the binaries and how the game launches.
Also there is "isFused":
https://love2d.org/wiki/love.filesystem.isFused

Re: Save directory different between fused and non-fused games

Posted: Tue Jul 03, 2018 11:35 am
by drunken_munki
ivan wrote: Mon Jul 02, 2018 6:59 pm Munki, it might be possible to use "love/dw" when running in fused mode but not vice versa.
There is no point in supporting both fused and non-fused modes -
you already have control of the binaries and how the game launches.
Also there is "isFused":
https://love2d.org/wiki/love.filesystem.isFused
Hey Ivan, the problem is this.

I have the game unfused with setIdentity() to 'DW'

Then I have made a ' Mod Manager' tool also in LOVE. But for simplicity I wanted this fused so I could put the exe into the main directory of the game. In this app, I set the identity to 'DW' also. This is where the save paths need to be the same so the mod manager can operate in the game space. This is where I had the initial problem.

But, I have now opted for both LOVE projects to be unfused anyway since I've come accross another problem.