Error saving plugin state

Posted by Larkin on Mon 02 Aug 2010 01:43 PM — 21 posts, 88,349 views.

#0
MUSHclient version 4.55

I get a message saying "Unable to create the plugin save state file: J:\SG1\fonts\blah blah blah.xml" for each plugin that tries to save its state. As you can see, I don't use the MUSHclient directory as my working directory, so I don't have a fonts subdirectory. In version 4.54, it was looking for J:\SG1\worlds\plugins\state, which made more sense than J:\SG1\fonts... :)
Amended on Mon 02 Aug 2010 01:44 PM by Larkin
USA #1
http://www.gammon.com.au/forum/?id=10439&page=999
#2
That's nice, but this is still a bug to be fixed. The default save directory for a plugin's state should not be the fonts folder.
USA #3
It's not based off the working directory. It's based off the Plugins directory (Global Options Ctrl+alt+G / Plugins tab). I'm guessing that is set to your fonts directory.

At the end of the thread, Nick mentioned the new Options in the mushclient_prefs.sqlite db. Set that to a valid path.
#4
Nope. My plugins directory is the same as my working directory.
Australia Forum Administrator #5
Try:


print (GetInfo (85))  --> .\worlds\plugins\state\


(That was what I got).

The trouble is, this value is a new field. Once changed (from the default of no value) the first time the default gets set up, if it is wrong it will stay wrong.

However looking more carefully at the code, I see perhaps it is setting up the default at the wrong time. As far as I can see, it sets up the default by appending state\ to the plugins directory *before* it has found out what the plugins directory is. The change I just made for version 4.56 might fix that.

[Commit 8ee06e4]

#6
I get the exact same result: .\worlds\plugins\state\. It was the fonts thing that really threw me off, as that made no sense for a default and I hadn't set it to that. :)

I suppose I'll have to manually change this option via a SetAlphaOption command now to fix it here?
Australia Forum Administrator #7
Ah yes.


SetAlphaOption ("StateFilesDirectory", "whatever")


The new version might fix it - sounds like the default is not being set properly.

[EDIT] Wrong! See my post below.
Amended on Tue 03 Aug 2010 12:00 AM by Nick Gammon
#8
I just did the SetAlphaOption, and GetInfo(85) still returns .\worlds\plugins\state\. Is 85 not the same as the StateFilesDirectory then?
USA #9
Are you restarting MUSHclient after setting the alpha option?
#10
I didn't the first time, but I just tried that and it's still set to the default value.
USA #11
And GetAlphaOption does show the value you set initially? Odd.
#12
I don't see it as an option on GetAlphaOptionList, so I'm not sure what you're asking or what I'm doing...
USA #13
You don't see StateFilesDirectory in the alpha option list? Then this:

Nick Gammon said:

SetAlphaOption ("StateFilesDirectory", "whatever")


Should have had no effect in the first place. Nick?
Australia Forum Administrator #14
Ah, I think I just did a major cock-up here. :)

The option in question was the default state file directory under global options. So it won't have any effect on the current value for a particular world.

Either my original fix was completely wrong, or my suggestions here are wrong. Or both.

Just to backtrack a bit, the plugins state files are (were) stored in the 'state' directory under the *default* plugins directory (not where a particular plugin happens to be).

The plugins directory is a *global* option "PluginsDirectory" (which you can change via the Sqlite3 interface).

Now after Willfa's request, there was an extra field added to Global options (not world options) which was the state file directory (default directory is not quite the right word - default for what?).

So if you change the global option "StateFilesDirectory" you can change where the state files go.

So as per this:

Template:post=10446
Please see the forum thread: http://gammon.com.au/forum/?id=10446.


You would need to do something like this:


sqlite3 mushclient_prefs.sqlite "UPDATE prefs SET value = 'C:\Program Files\MUSHclient\my_plugins\state\' WHERE name = 'StateFilesDirectory'"


I'm not sure this totally accounts for your "fonts" problem - but the bug I fixed might cause that. I have to admit this is a bit confusing.
USA #15
Nick Gammon said:

...

Now after Willfa's request, there was an extra field added to Global options (not world options) which was the state file directory (default directory is not quite the right word - default for what?).

So if you change the global option "StateFilesDirectory" you can change where the state files go.

So as per this:
...


Oh sure, Blame me. ;)

In my defense, you and I both quoted the same post, and I pointed this out in that thread

WillFa said:

I wanted to add a couple of small things.

The default of "./worlds/plugins/state" is based off the current directory, which can change in the shortcut. It may be a more reliable solution to base the default off the user's Plugin Directory (GetInfo(60)) instead of the MC install dir.

It should be noted in the documentation that this string expects the trailing backslash on the path. i.e. "C:\Users\Foo\Documents\PluginStates\"


Thanks again!



Though I think Larkin may have skimmed over it when I posted it in the first reply to this thread.
#16
I didn't skim! This is a related but different issue. :P
Australia Forum Administrator #17
Well if you do the sqlite3 thing, does it fix it?
#18
Once I figured out where Windows 7 put my prefs database, I was able to set the directory to .\state\, and that has fixed the issue. My map remembers colors and position again! Yay!
USA #19
Told ya so. :P
Australia Forum Administrator #20
Just a reminder, as mentioned on this page:


http://www.gammon.com.au/db

... there is a GUI SQLite3 database editor available for download:

http://sourceforge.net/projects/sqlitebrowser/


If you fire that up, and open the prefs database, you can easily view and edit individual settings, without having to type in lengthy SQL statements.