4.61: GetInfo(67) in OnPluginInstall returns .

Posted by Tspivey on Wed 15 Sep 2010 05:44 PM — 5 posts, 19,295 views.

Canada #0
When I create a plugin with something like:
Note(GetInfo(67))
it prints ".\".
I expect it to print the directory where the .mcl file is located,
like it does when I reload the plugin. If this is expected behaviour, is there a workaround?
Australia Forum Administrator #1
Has the world file in question ever been saved? Like, did you just create a new world and add the plugin to it? If the file hasn't been saved it can't have a file name. Otherwise it should be the full pathname to it.
Canada #2
The world is saved. To verify, I did the following:
1. Created and saved a new world with ip address 0.0.0.0 so it didn't connect to anything.
2. Opened the plugin wizard, filled in the fields with test,, went to the script tab and typed:

function OnPluginInstall()
Note(GetInfo(67))
end

Created and saved the plugin, and loaded it. So far all is well, and it prints "C:\Program Files\MUSHclient\worlds\."

Saving the world again and re-opening, the plugin prints ".\".
If I reinstall the plugin, the correct path is displayed.
Australia Forum Administrator #3
Thanks for the detailed description. I can reproduce that. Very weird. I'll look into it.
Australia Forum Administrator #4
Well it seems there is a strange behaviour in the internal libraries. It calls the "you are being opened" function just *before* it stores the pathname of the world file.

I have added an extra line into version 4.62 to fix that.

Meanwhile, all I can suggest is either waiting slightly (even 0.1 seconds with a DoAfterSpecial function call) as you will find it will be OK providing you don't do it in OnPluginInstall, or since you just want the directory, try GetInfo (57) which is the default world files directory. That would hopefully be where the file is anyway.