Far 2 build 1148+ Warning for Plugin Developers

A place where plug-in developers can share their knowledge and experience.
Post Reply
free3dom
Posts: 20
Joined: Sat 15 Aug, 2009 18:54

Far 2 build 1148+ Warning for Plugin Developers

Post by free3dom » Thu 01 Oct, 2009 22:28

To all plugin devs:

I have had two plugins (one of my own) break after build 1148+ (I actually first found it in b1151, but was told by someone it started in b1148). The reason for the "break" is that FAR no longer sets the current working directory of the process to that of the active panel (or changes it when a plugin runs?). This means that using a filename from the active panel (without prefixing with the path) results in a "file not found" - I didn't check what the CWD was, but it is definitely not the current panel.

I don't know if this is intentional or a bug...couldn't find anything about it in the changelog (which I had to translate from russion, so it may be there). But this is a fairly big change that could potentially break any existing plugin that accesses selected items or all items in the current panel (where I used to assume, correctly, that it was the current working directory).

Anyway, to circumvent this I just manually set the current working directory upon startup of my plugin and the rest of the code could run unchanged.

Assume Nothing...Trust No One :ha:

User avatar
Px
Posts: 826
Joined: Fri 08 Sep, 2006 15:52
Location: Вишнёвый (под Киевом)
Contact:

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by Px » Thu 01 Oct, 2009 23:35

FCTL_GETCURRENTDIRECTORY ?

Игорь Юдинцев
Posts: 725
Joined: Sun 03 Apr, 2005 22:00
Location: Казань
Been thanked: 1 time

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by Игорь Юдинцев » Fri 02 Oct, 2009 08:24

free3dom wrote:couldn't find anything about it in the changelog (which I had to translate from russion, so it may be there).
http://farchangelog.blogspot.com
the post for build #1145.


User avatar
HaRT
Moderator
Posts: 7985
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 66 times
Been thanked: 98 times

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by HaRT » Fri 02 Oct, 2009 10:21

free3dom wrote:I don't know if this is intentional or a bug
This is intentional; see b.1145 at http://farchangelog.blogspot.com/2009/09/11451148.html.
free3dom wrote:Anyway, to circumvent this I just manually set the current working directory upon startup of my plugin and the rest of the code could run unchanged.
Please note that your code will probably fail on long paths due to SetCurrentDirectory limitations.
Фар есть инструмент, а не нянька. © 2009 DrKnS

free3dom
Posts: 20
Joined: Sat 15 Aug, 2009 18:54

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by free3dom » Fri 02 Oct, 2009 18:38

Thanks for the replies, never knew about the english changelog...that'll be handy :Yahoo!:

I am aware that the SetCurrentDirectory is limited to MAX_PATH, and merely used it as 'quick fix' since I didn't
know whether or not the change was intentional (or permanent). Knowing that it is, I can now do it properly
using the path prefix for files.

Post Reply

Return to “Plug-In Developers”

Who is online

Users browsing this forum: No registered users and 1 guest