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

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
drunken_munki
Party member
Posts: 134
Joined: Tue Mar 29, 2011 11:05 pm

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

Post 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
Last edited by drunken_munki on Tue Jul 03, 2018 11:36 am, edited 4 times in total.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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).
Me and my stuff :3True 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.
User avatar
pgimeno
Party member
Posts: 3673
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
drunken_munki
Party member
Posts: 134
Joined: Tue Mar 29, 2011 11:05 pm

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

Post 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.
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post 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
drunken_munki
Party member
Posts: 134
Joined: Tue Mar 29, 2011 11:05 pm

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests