#Windows State Plugin not exiting correctly on windows 11

51 messages · Page 1 of 1 (latest)

silk canopy
#

In my app, i am using the $APPCONFIG and $APPDATA paths - however i have recently upgraded one on my machines to use windows 11 and discovered that on windows 11 these dirs point to C:\Users\<user>\AppData\Local\<identifier>. While on Windows10 these dirs point to C:\Users\<user>\AppData\Roaming\<identifier>

Is there a built-in method to detect whether the user is on win10 or win11 so that i can programmatically switch?

I know that i can do this in rust - i am just curious if there is a built-in (for tauri) api to do this, as i have not seen it listed in the docs.

stone peak
#

they are supposed to point to the same location

#

windows 10 and 11 are really the same os so the os wouldn't break this itself. maybe the dirs crate detects something incorrectly, but i've not heard anyone else complaining about this 🤔

silk canopy
#

Hmm, i am just using the tauri fs and path api and it works correctly on win10 - and not on win11. No change to the code base.

I just did some more snooping and it seems that the paths are pointing to the correct location - the issue seems to be that in win11 the app indentifier folder is not being created on app-close, like it does on win10.

My window state is also not being saved - which makes sense, as that file is stored in the same directory, and works fine on win10.

#

On win10 the com.eyetrackvr.dev folder was created after i launched and closed the app (release binary) for the first time, at least once. It was created on app-close.

stone peak
#

so tauri itself won't create that dir

silk canopy
stone peak
#

no, it can't do that

#

except the one in AppData/Local

silk canopy
#

it was before

#

i never created it

stone peak
#

in your case it was probably the window-state plugin

#

because tauri itself never creates it

#

and never did

silk canopy
#

hmmm - that could be. Valid - but then why is that not working on win11?

stone peak
#

that is a good question

#

somehow the exit event handler seems to crash or something?

#

lemme take a look at the plugin real quick

silk canopy
stone peak
#

ah my bad :D

silk canopy
#

haha - text be like that sometimes.

stone peak
#

so the plugin still tries to create the dir, that part didn't change. But other code stuff changed. If you do tauri dev and close the window via the x, does it complain it any way in the terminal?

silk canopy
#

one moment, will check

#

it does not - just says Done in <time>

stone peak
#

and if you create the dir in Roaming manually? does it create the file then?

silk canopy
#

It does not - but it does send an error:
error Command failed with exit code 4294967295.

stone peak
#

that one should be unrelated. It was either the webview or the beforeDevCommand, can't remember

silk canopy
#

My other assets, however, did populate - so tauri is working correctly,

stone peak
#

do you use native window controls or a custom titlebar?

silk canopy
#

I have a custom titlebar

#

decorations are off

stone peak
#

can you enable decorations and use the native x button for a test?

silk canopy
#

sure

#

You are correct - that worked. The file was created. I am going to delete the directory now and see if it also creates the folder.

#

I think it will

#

Windows State Plugin not exiting correctly on windows 11

#

Yes, that worked as well.

stone peak
#

i mean, it kinda makes sense since undecorated windows don't trigger the CloseRequested events

silk canopy
stone peak
#

maybe the file is still older from when you had decorated windows?

#

restoring them works either way, it's just the saving part

silk canopy
#

It was indeed creating the file no problem with a custom titlebar on win10

stone peak
silk canopy
stone peak
stone peak
silk canopy
#

I tested it on multiple machines, as there was logic that needed to find that folder - so i needed to see when it was created.

#

But, according to the readme - i could do that on app load. Which, imo, is much nicer.